Sending message to a specific ID in Socket.IO 1.0

In socket.io 1.0 they provide a better way for this. Each socket automatically joins a default room by self id. Check documents: http://socket.io/docs/rooms-and-namespaces/#default-room

So you can emit to a socket by id with following code:

io.to(socketid).emit('message', 'for your eyes only');

Leave a Comment