-
Notifications
You must be signed in to change notification settings - Fork 10.1k
Description
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:
socket.io/lib/broadcast-operator.ts
Lines 262 to 265 in 8ecfcba
| .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