-
-
Notifications
You must be signed in to change notification settings - Fork 894
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Room Deletion #702
Comments
Rooms are not automatically deleted. You can use the |
@miguelgrinberg Thank you so much for your reply. So, I need to close the room manually. I have some thought on implementing this manual way, like close room when user disconnecting and room is empty. How do I check if the room is empty ? I see there is no function for that in the documentation. Regarding to the default room when user connected, I have read that a connected client have socket#id as their default room. is this default room need to close manually like room that we made manually ? Thank You |
You can't check if a room is empty unless your application keeps track of who's in each room. This is because Flask-SocketIO is a distributed server, each server process knows about a fraction of the complete state. There is no need to close the id-based rooms, those go away on their own. |
@miguelgrinberg thank you for your explanation. Maybe I can use the message queue feature from multi worker documentation to track room and user connection. While I am planning to use multi worker and using Redis as message queue, maybe Redis got that information, right ? May I know what Flask-Socketio store to message queue such as Redis ? |
Redis is used as a pub/sub provider, there is no data stored there. As I said, the state is partitioned among the many servers, there is no place you can go to see a consolidated state, and for that reason the list of participants in a room cannot be provided. But your application should be able to easily track that down in your own database. |
Alright, I see. I understand know, thank you for your amazing explanation. I am building user tracking now. |
What about server restarts ? Because o keep track using a counter when user connects/disconnect, should i reset the value to 0 when server restart ? |
@valentin-ballester If your server restart does not involve disconnecting the users gracefully, then yes, you should. Or another method is to have a "last active" timestamp for each user, so after some time of inactivity the user is considered gone. |
Hi,
I just would like to know if the room will be deleted automatically when a client / user is no longer on the room / room is empty ?
If not, how can I cleaned up empty rooms ?
Thank You
The text was updated successfully, but these errors were encountered: