Sunday, March 25, 2012

socket.io How to get list of clients in room


//get member list
var clients = io.sockets.clients(<Room name>)
//send messege to each members
for(var i=0;i<clients.length;i++){
  var clientSocket = clients[i];
  clientSocket.emit('indivisual message',{memberID: i});
}

The type  of return's value is Array.

No comments:

Post a Comment