I have this scenario with socket.io:
A socket connects and joins a room and he is the master. Other sockets join his room. When master disconnects I want to kick all other sockets from this room.
I thought of this:
socket.on('disconnect', function(data){ // if socket's id == room he is the master and kick other sockets from this // room and join them to a room of their own identified by their ids. });
I want to do this without too much logic and for loops to stall the application. Is it possible to something like io.sockets.leave(socket.room)
?