In that case every socket in the room excluding the sender will get the event.
Socket io rooms not working.
To leave a channel you call leave in the same fashion as join both methods are asynchronous and accept a callback argument.
When i use socket join xxx socket rooms can t be set.
Within each namespace you can also define arbitrary channels that sockets can join and leave.
Additonally if rooms list is temporary you can clean it whit controlled event after disconnecting.
Once again let me know if there s anything else you d like me to test or try and reproduce the issue.
Rooms also share the same socket connection like namespaces.
Please use the classic socket emit instead.
So my socket join calls are doing nothing.
Although socket io indeed uses websocket as a transport when possible it adds additional metadata to each packet.
After calling socket join and then listing the rooms the socket is in the socket is only connected to the room defined by it s id it s own room.
But first let s detail what the socket io library is not.
Rooms are used to further separate concerns.
These channels are called rooms.
To add to this i have downgraded versions of socket io back to 1 5 0 and still getting the same issue.
One thing to keep in mind while using rooms is that they can only.
In disconnect event you can query this object to know the rooms you have to leave.
Socket io provides additional features over a plain websocket object which are listed below.
I have also tried reconfiguring my server to match the suggestions made by raghavgarg1257 and it still did not work either.
What socket io is not.
Steps to reproduce if the current behaviour is a bug async socketjoinroom socket.
Socket to socket id emit will not work as it will send to everyone in the room named socket id but the sender.
Where you can save socket id or other identifier with rooms.
Each socket in socket io is identified by a random unguessable unique identifier socket id for your convenience each socket automatically joins a room identified by its own id.
In server code socket rooms is not an array that is a object.
Repost from so but i need answers so here.
If you are using some db o nosql you can save it for distributed environments.