The AVL Tree Car Backend uses Flask-SocketIO to push real-time AVL tree updates to connected clients. Instead of polling a REST endpoint, clients open a persistent Socket.IO connection and receive tree state changes the moment they happen — insertions, deletions, rebalances, and traversal streams all arrive as events. The primary namespace for all tree operations isDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/tutosrive/avl_tree_car/llms.txt
Use this file to discover all available pages before exploring further.
/AVLTree; the root namespace / handles the bare connection lifecycle.
Namespaces
The server exposes two Socket.IO namespaces, each with a distinct responsibility.| Namespace | Purpose |
|---|---|
/ | Connection lifecycle only — emits connected on open and disconnected on close |
/AVLTree | All AVL tree operations: read state, reset, remove obstacle, stream traversals |
/AVLTree for any tree work. The root namespace is managed automatically by the server’s SocketManager and requires no manual interaction from tree clients.
Connecting
Response Envelope
Every event emitted by the server — lifecycle or operational — wraps its payload in the sameResponseSocket envelope. Clients can rely on a consistent shape regardless of which event they are handling.
true when the operation completed successfully; false when it failed (e.g., obstacle not found, tree empty).The raw message the client sent when triggering the event. Useful for correlating responses to requests on the client side.
A human-readable description of the result — for example
"This is the tree by moment!" or "Obstacle removed!".The event payload. For tree-state events this is a nested
{id, children} dict produced by AVLTree.to_dict(). For traversal events it is a single obstacle ID string. null when there is nothing to return (e.g., on a bare connected event).If the underlying Python object has a to_dict() method, ResponseSocket calls it automatically before serialising.Error details when
ok is false, otherwise null. May be an exception message string.CORS
The server is initialised withcors_allowed_origins="*", so connections are accepted from any origin. This is suitable for local development and game clients running on the same machine.
The
SocketManager constructor passes cors_allowed_origins directly to Flask-SocketIO’s SocketIO base class. No additional CORS settings are configured beyond cors_allowed_origins="*".Next Steps
For the complete list of events, payloads, and code examples for every operation in the/AVLTree namespace, see the Socket Events reference.