If a socket leaves its default room, socket.to('room').emit messages will be received by it despite being sender #4524
Labels
enhancement
New feature or request
Milestone
Describe the bug
If a socket leaves the default room which matches its socket id, socket.to('room').emit messages will be receives by the client of the sender, even though the documentation makes no mention of this.
To Reproduce
Please fill the following code example:
Socket.IO server version:
4.5.3
Server
Socket.IO client version:
4.5.3
Client
Expected behavior
I would not expect that leaving the default room would mean the sender receives a message that otherwise it shouldn't. My idea of leaving the default room is that I can ensure each connected client is only in a single room, and then when emitting to the room they're in I was hoping to use:
Perhaps there is a different expected way to use rooms but it would seem a bit clunky to use const [, second] = socket.rooms if I leave each client in the default room?
Platform:
The text was updated successfully, but these errors were encountered: