How can I emit a request from a server to the client, to only one client...
I know that io.sockets.to(room).emit('event' data)
exists, but I don't hear about socket.to(room).emit
How can I emit a request from a server to the client, to only one client...
I know that io.sockets.to(room).emit('event' data)
exists, but I don't hear about socket.to(room).emit
There are namespaces and rooms in socket.io. You can join every user to unique room with .join
and send event to that room with socket.to(room).emit
. How to do that read here
http://socket.io/#how-to-use
https://github.com/LearnBoost/socket.io/wiki/Rooms
or
var io = io.listen(server);
io.clients[sessionID].send()