TheDocumentation 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 namespace exposes 8 events — 2 lifecycle events managed automatically by the connection and 6 operational events your client actively triggers. All responses follow the ResponseSocket envelope: every emission carries ok, received, message, data, and error at the top level.
connect → connected
The Socket.IO transport fires connect the moment a client successfully opens a socket to /AVLTree. The server responds immediately with a connected event confirming the namespace is ready.
Client payload: none — this is triggered by the transport layer, not a manual emit.
Server emits: connected
The root namespace
/ connect handler emits message: "The Socket is Connected, ready to use!". The /AVLTree namespace connect handler has no custom callback, so it emits the default ResponseSocket message "OK".disconnect → disconnected
Fired automatically when a client closes the connection or the transport drops. The server emits disconnected and then stops the Socket.IO server instance.
Client payload: none — triggered by the transport layer.
Server emits: disconnected
get_tree_avl → avl_tree_balanced
Request the current state of the AVL tree. The server serialises the entire tree into a nested {id, children} structure and returns it in data.
Client payload: any value (the message is echoed back in received but is not used by the server).
Server emits: avl_tree_balanced
The serialised tree produced by
AVLTree.to_dict(). Each node is {"id": "<8-char ID>", "children": [...]}. null when the tree is empty.reset_avl → avl_reseted
Reset the AVL tree to an empty state. All nodes are removed and the root is set to null. The server responds with avl_reseted carrying the now-empty tree.
Client payload: any value.
Server emits: avl_reseted
Always
null after a reset because the tree root is None.remove_obstacle → avl_tree_balanced
Delete a specific obstacle node from the AVL tree. The server locates the node by its (x, y) coordinates and removes it, rebalancing the tree automatically. The response confirms success or failure — data is always null after this event. On failure the response has ok: false and an error message.
Client payload:
The horizontal position of the obstacle to remove. Must match an existing node’s
x value exactly.The vertical position of the obstacle to remove. Must match an existing node’s
y value exactly.The obstacle type identifier (1–10). Used to reconstruct the
Obstacle object for the tree search.avl_tree_balanced
Always
null for this event. The emit_obstacle_removed handler sets only response.message and response.ok — it does not attach the updated tree to data. To retrieve the current tree state after a removal, emit get_tree_avl.road_preorder → preorder
Stream all obstacle IDs in preorder traversal order (root → left subtree → right subtree). The server emits one preorder event per obstacle with a one-second delay between emissions.
Client payload: any value.
Server emits: preorder — one event per obstacle until all are sent.
The server emits each obstacle ID with a
time.sleep(1) delay between them, so a tree with n nodes produces n events over n seconds. Each emission’s data field is a single obstacle ID string (e.g. "0A2B4C6D"), not the full tree.road_inorder → inorder
Stream all obstacle IDs in inorder traversal order (left subtree → root → right subtree). Because the AVL tree is keyed on the obstacle’s x coordinate, inorder traversal yields obstacle IDs sorted by ascending horizontal position.
Client payload: any value.
Server emits: inorder — one event per obstacle, one second apart.
The server emits each obstacle ID with a
time.sleep(1) delay between them, so a tree with n nodes produces n events over n seconds. Each emission’s data field is a single obstacle ID string representing one obstacle encountered along the road in sorted order.road_posorder → posorder
Stream all obstacle IDs in posorder traversal order (left subtree → right subtree → root). Useful for processing child nodes before their parent — for example, clearing leaf obstacles before interior ones.
Client payload: any value.
Server emits: posorder — one event per obstacle, one second apart.
The server emits each obstacle ID with a
time.sleep(1) delay between them, so a tree with n nodes produces n events over n seconds. Each emission’s data field is a single obstacle ID string for one obstacle in posorder sequence.