Skip to content

feat(socket.io): allow passing a Set to to(), in(), and except()#5507

Open
vipin8797 wants to merge 1 commit into
socketio:mainfrom
vipin8797:feat-set-room
Open

feat(socket.io): allow passing a Set to to(), in(), and except()#5507
vipin8797 wants to merge 1 commit into
socketio:mainfrom
vipin8797:feat-set-room

Conversation

@vipin8797

Copy link
Copy Markdown

The kind of change this PR does introduce

  • a bug fix
  • a new feature
  • an update to the documentation
  • a code change that improves performance
  • other

Current behavior

Currently, the to(), in(), and except() methods only accept Room or Room[]. If a developer wants to pass a Set of rooms, they have to manually convert it to an array first (e.g., using Array.from()).

New behavior

The to(), in(), and except() methods now natively accept Set<Room> in addition to Room and Room[]. This is a natural extension of the existing array support.

Updated across all entry points: BroadcastOperator, Namespace, Socket, and Server.
I have also added the relevant unit test ("emits to rooms with a Set") to ensure the functionality works as expected.

Other information (e.g. related issues)

Closes #5418

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant