Ismael Moral
Ismael Moral

Reputation: 732

Emit message to certain socket id in socket 2.0

I'm using socket 2.0 for a chat, and I would like to send messages from server side to a certain socket id I have stored in array. How can I do that, I don't see it clearly in socket.io docs.

Upvotes: 0

Views: 320

Answers (1)

foxinatardis
foxinatardis

Reputation: 156

From : https://socket.io/docs/emit-cheatsheet/

// sending to individual socketid (private message)
  socket.to(<socketid>).emit('hey', 'I just met you');

Upvotes: 1

Related Questions