Events when rooms are created and deleted automatically.
Hi,
I am working on a project where rooms are created and deleted dynamically and I don't have any way of knowing when a room is created or deleted. it would be nice to have this feature. Now I am counting the number of users on that room when joining and if it is only one then the room is being created..., but that is not efficient and would be nice to have an event like on room creation or deletion.
Thank you in advance!
Until someone decides to do this or not, a suggestion you might benefit from possible using something like redis to keep track of the rooms. I know it isn't directly sockets handling it, but redis works really well for dynamic rooms with socket.io, keeping track of users in each room, and whether they are still open or not.
I believe the best way is to implement that feature independently from socket.io itself. I'm not even sure if the most recent version deletes empty rooms at all (at least without redis adapter). You may want to take a look at the socket.io-hotel package (https://github.com/gpestana/socket.io-hotel) , which is a seamless room manager for socket.io. That feature is not implemented but suggest it or patch it.
@gpestana rooms are deleted automatically when empty.
@rauchg thoughts on adding the event?
That issue was closed automatically. Please check if your issue is fixed with the latest release, and reopen if needed (with a fiddle reproducing the issue if possible).