-
Notifications
You must be signed in to change notification settings - Fork 10.1k
Closed
Description
I have a system in which a lot of clients are constantly joining and leaving rooms and I see this weird behavior in which I do:
socket.join(someRoom);and them on the next line I have:
console.log(io.of('/').adapter.rooms[someRoom][socket.id])which prints true most of the time, but sometimes I get undefined
in Socket class source code I see this line that stops socket from joining the room:
if (~this.rooms.indexOf(room)) return this;So I now I see that problem is that adapter.rooms and socket.rooms are out of sync for some reason.
Also in the Adapter.prototype.add() I see this:
if (fn) process.nextTick(fn.bind(null, null));So apparently adapter.rooms and socket.rooms are updated in different event loops. Might this be causing the problem?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels