-2

I'm using socket.io for building the real-time dashboard,

I want to send data to each connection as separate,

How to achieve this functionality in node.js using socket.io?

io.emit('someEvent', {data: 'data'});
Vithal Reddy
  • 392
  • 1
  • 6
  • 12

1 Answers1

-1

Use the following method to emit to particular socket.id

io.sockets.connected[socket.id].emit('even', {
        data: `successfully fetched dat for user ${reqUser.user.userName}.`
});
Vithal Reddy
  • 392
  • 1
  • 6
  • 12