Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

BroadcastOperator.fetchSockets() ignores flags #4359

Closed
schw4rzlicht opened this issue May 2, 2022 · 2 comments
Closed

BroadcastOperator.fetchSockets() ignores flags #4359

schw4rzlicht opened this issue May 2, 2022 · 2 comments
Labels
bug Something isn't working
Milestone

Comments

@schw4rzlicht
Copy link

schw4rzlicht commented May 2, 2022

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

@derikb
Copy link

derikb commented May 17, 2022

Would I think, save us some crazy extra redis usage if this could get released (please, thank you). Our pubsub traffic went a bit crazy when we updated to 4 and I think this is at least one of the causes. (Thanks for noticing this @schw4rzlicht and thanks for fixing it @darrachequesne )

@darrachequesne
Copy link
Member

Letseee go: https://github.com/socketio/socket.io/releases/tag/4.5.1

@darrachequesne darrachequesne added bug Something isn't working and removed to triage Waiting to be triaged by a member of the team labels May 17, 2022
@darrachequesne darrachequesne added this to the 4.5.1 milestone May 17, 2022
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants