Describe the bug
When using BroadcastOperator.fetchSockets(), flags that were set before (e.g. with io.local.fetchSockets() → sets local: true flag) are ignored.
This leads to all sockets across all nodes being returned for example instead of only the local ones.
I suspect this code to be responsible:
|
.fetchSockets({ |
|
rooms: this.rooms, |
|
except: this.exceptRooms, |
|
}) |
To Reproduce
Socket.IO server version: 4.4.1
Server
see https://github.com/fan711/socket-server
Socket.IO client version: 4.4.1
Client
see https://github.com/fan711/socket-client
Expected behavior
Previously set flags on BroadcastOperator should be respected. I'd suggest following change but I am not sure about any implications this might have, thus opening this as an issue instead of a PR:
.fetchSockets({
rooms: this.rooms,
except: this.exceptRooms,
+ flags: this.flags,
})
Additional context
Initially suspected https://github.com/socketio/socket.io-redis-adapter and opened socketio/socket.io-redis-adapter#454 but I am happy to close that one if this one here is confirmed.
/cc @fan711
Describe the bug
When using
BroadcastOperator.fetchSockets(), flags that were set before (e.g. withio.local.fetchSockets()→ setslocal: trueflag) are ignored.This leads to all sockets across all nodes being returned for example instead of only the local ones.
I suspect this code to be responsible:
socket.io/lib/broadcast-operator.ts
Lines 262 to 265 in 8ecfcba
To Reproduce
Socket.IO server version:
4.4.1Server
see https://github.com/fan711/socket-server
Socket.IO client version:
4.4.1Client
see https://github.com/fan711/socket-client
Expected behavior
Previously set flags on
BroadcastOperatorshould be respected. I'd suggest following change but I am not sure about any implications this might have, thus opening this as an issue instead of a PR:.fetchSockets({ rooms: this.rooms, except: this.exceptRooms, + flags: this.flags, })Additional context
Initially suspected https://github.com/socketio/socket.io-redis-adapter and opened socketio/socket.io-redis-adapter#454 but I am happy to close that one if this one here is confirmed.
/cc @fan711