This question originally came up in our Slack community and the thread has been consolidated here for long-term reference.
Is there a way to set a room to be instantly destroyed when empty (not wait 30 seconds)?
We use static room names (like a “Lobby” room). When a room becomes empty, the agent disconnects, then soon after the room is destroyed. During that short window, if another user joins, the agent won’t be dispatched again.
Would setting departure_timeout=0 help?
You can set the departure_timeout for the room during creation:
However, for static room names with agents that disconnect before room destruction, consider these alternatives:
- Use unique room names: Generate a unique room name for each session to ensure fresh agent dispatch
- Keep the agent connected: Set
close_on_disconnect to false in your agent to prevent it from leaving when participants leave
- Have the agent delete the room: When the last participant leaves, have the agent delete the room itself