what does this await connection_manager.cleanup() ...
# ask-ai
p
what does this await connection_manager.cleanup() do exactly?
t
Thanks for reaching out, Yasser. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
The
await connection_manager.cleanup()
method in LiveKit helps tidy things up by releasing resources, resetting states, and handling disconnection smoothly. Here’s what it does: • Frees up resources like WebRTC peer connections, data channels, and WebSocket connections. • Stops all local and remote tracks so no media keeps playing or streaming. • Resets internal state variables and clears out cached data, participants, and session info. • Disconnects from the LiveKit room in a graceful way, removing the participant and letting listeners know about the disconnection. This method is super important to keep your app running cleanly and efficiently, especially when you’re disconnecting or getting ready to reconnect. Sources: room.go | src/room/RTCEngine.ts | mcp_client/server.py | README.md | lib/src/core/signal_client.dart