This question originally came up in our Slack community and the thread has been consolidated here for long-term reference.
How should I handle page reloads / page close and reopen?
I see that the agent session is closing, but the agent participant is still in the room. Does closing an agent session also remove the participant?
By default, the room will remain open for 20 seconds after participants leave, which should allow the client browser reload to reconnect.
To control this behavior, set close_on_disconnect to False in RoomOptions:
This will give the client up to 20 seconds to reconnect to the room if they leave, avoiding complex re-dispatching logic.
For different sessions, it is recommended to create a new room ID.