Skip to content

BroadcastOperator.fetchSockets() ignores flags #4359

Closed
@schw4rzlicht

Description

@schw4rzlicht

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions