Hey guys, I need to close a room and disconnect all users who are in it, how do I do this?
The close_room() function will close a room and remove all users from it. It will not disconnect the users from their Socket.IO connections though. Is that sufficient?
Yeah, thank you!! Is it possible to disconnect all clients and then delete the room ?
If your application knows which users are in the room, you can call disconnect() on each of them. There is no mass disconnection feature at this time.
Okay, thank you very much for the help!!
Hey @miguelgrinberg, can you tell me what the lifetime of a socket is? and how damaging is leaving multiple sockets open?
The socket is connected until one of the parties disconnects. Leaving sockets open consumes file handles, not a good idea to leave them open if they are not needed because file handles are a limited resource. For example, if you have a file handle leak, eventually you'll reach a point where the process will not be able to open any new connections.
Okay, thank you !! Can you tell me what would be the maximum number of simultaneous sockets?
There is no maximum, the max is dictated by available memory, limit of file handles in the OS, etc.
Most helpful comment
The close_room() function will close a room and remove all users from it. It will not disconnect the users from their Socket.IO connections though. Is that sufficient?