Skip to content
This repository was archived by the owner on Oct 22, 2025. It is now read-only.
This repository was archived by the owner on Oct 22, 2025. It is now read-only.

Add ability to broadcast to everyone but yoursefl #938

@NathanFlurry

Description

@NathanFlurry

Motivation

Add ability to broadcast to conns except for the conn that sent the RPC request. Only available on ActionContext.

Implementation

actor({
  actions: {
    foo: c => {
      c.broadcast("bar", 123, { excludeSelf: true });
    }
  }
});

excludeSelf naming could use some work.

Alternative Implementations

exclude

Add a more generic option for just excluding connection IDs.

actor({
  actions: {
    foo: c => {
      c.broadcast("bar", 123, { exclude: [c.conn.id] });
    }
  }
});

It might make sense to implement both, since broadcast to all but self is a very common operation.

broadcastToOthers

Same functionality as excludeSelf but a separate method name.

Prior Art

Socket.io:

  io.except(excludedSocketId).emit('broadcastEvent', data);

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions