Prido's avatar
Level 2

Nodejs & Socket.io

hi guys, i am creating a live chat app using nodejs and socket.io. My question is on handling sockets. How do you guys handle them like, on client connect to you auto join them all the one on one conversations they have or do you just add the user socket onto something like redis then emit to it whenever any message from their conversations arrive or something else. basically my system will have companies, agents, contacts. Contacts are just users coming on the live chat. agents handle contacts queries and agents can view conversation limited to departments assigned to them. Briefly how would i want to handle sockets in theory?

0 likes
1 reply
martinbean's avatar

@prido Would it not be better to just have a socket per user? Then you can emit events to the users that are relevant to that message.

Please or to participate in this conversation.