0

In need to know, how "user a" can send "user b" a message using socketIo in nodejs.

Reading the documentation of socketIo, there is a clear explanation of not using the id of an socket as an userid, because after every reconnection the socketid is regenerated.

SocketIo Documentation

But reading this article on stackoverflow and other tutorials telling me the opposite.

So what is the correct way?

Thanks

cwf
  • 1
  • 1

1 Answers1

0

In a messaging application you should probably store your roomID (you can create an unique uid which can act as a room and connect the users using the roomId) in a database so that both the users get connected to a specific room and send/receive messages.