Skip to content

Allow to emit message to several rooms at once #3313

Closed
@angel1st

Description

@angel1st

Note: for support questions, please use one of these channels: stackoverflow or slack

For bug reports and feature requests for the Swift client, please open an issue there.

For bug reports and feature requests for the Java client, please open an issue there.

You want to:

  • request a feature

Current behaviour

Thanks to #2879 it is possible to join several rooms at once.

It would be nice to have the same for sending a message to multiple rooms.
Currently, we can achieve it with following code snippet:

['room1', 'room2', 'room3'].forEach(room => {
  // send message to all clients in the room, but the sender
  socket.broadcast.to(room).emit('message', 'nice game');
});

It would be much better if we can have it like that:

io.in(['room1', 'room2', 'room3']).emit('message', 'cool game');
socket.broadcast.to(['room1', 'room2', 'room3']).emit('message', 'nice game');

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions