Answer the question
In order to leave comments, you need to log in
Socket.io + node js Rooms How to split rooms on socket.io side?
Hello everyone, such a problem, I wrote a chat on socket.io + node js.
Divided into rooms using the usual checks in the blade.
All rooms are displayed in site/chats
Separate room site/chats/chat_number
The problem is that if any user writes to the chat, it will be displayed for everyone.
All IDs of chats and messages are stored in the database, I tried to check for IDs, it doesn’t work, maybe I didn’t do it right.
(Attached a screenshot to check that works!)
But this is not a solution, because this is done for a single chat, we checked that if the chat_id that we get by class from the blade will be equal to this chat ID, that is, 1 to 1, then let prints, when the socket wants to load this "Printing..." in another chat, the check fails.
And I don’t know how to substitute here, I can’t just do chat_id === chat_id otherwise it will load the same thing from the blade and it will display this word and messages exactly everywhere.
I'm on my second day and can't decide...
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question