2

How can in send data to a specific connected socket in Node.js? I want to write a server that accepts incoming sockets, assigns them an id, and then when messages are sent from the other client, it is directed to that one. I guess you could say similar to a private message.

Also, is there a way to emit data EXCLUDING one socket?

LordZardeck
  • 7,953
  • 19
  • 62
  • 119

1 Answers1

1

There are similar questions on stackoverflow, here's an example:

Sending a message to a client via its socket.id

Quick version:

io.sockets.socket(id).emit('hello');
Community
  • 1
  • 1
alessioalex
  • 62,577
  • 16
  • 155
  • 122
  • Thanks. I guess i just didn't know how to word it. The is my first day using node js and i can't hardly find anyithing to help beginners learn. – LordZardeck Jan 18 '12 at 22:32