我有这种情况与socket.io:Socket.io插座断开
套接字连接和加入一个房间,他是主人。其他插座加入他的房间。当主人断开时,我想踢这个房间的所有其他插座。
我想到了这一点:
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.
});
我想这样做,没有太多的逻辑和循环来搪塞应用。是否有可能类似io.sockets.leave(socket.room)
?
你可以编辑他的答案。 – mak 2013-07-04 10:24:37