0

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

Ben
  • 48,249
  • 32
  • 114
  • 131
Adacho
  • 89
  • 4
  • 13

1 Answers1

0

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()
sirjay
  • 1,565
  • 2
  • 25
  • 47