MCPcopy Index your code
hub / github.com/socketio/socket.io / except

Method except

packages/socket.io/lib/broadcast-operator.ts:93–106  ·  view source on GitHub ↗

* Excludes a room when emitting. * * @example * // the "foo" event will be broadcast to all connected clients, except the ones that are in the "room-101" room * io.except("room-101").emit("foo", "bar"); * * // with an array of rooms * io.except(["room-101", "room-102"]).emit("fo

(room: Room | Room[])

Source from the content-addressed store, hash-verified

91 * @return a new {@link BroadcastOperator} instance for chaining
92 */
93 public except(room: Room | Room[]) {
94 const exceptRooms = new Set(this.exceptRooms);
95 if (Array.isArray(room)) {
96 room.forEach((r) => exceptRooms.add(r));
97 } else {
98 exceptRooms.add(room);
99 }
100 return new BroadcastOperator<EmitEvents, SocketData>(
101 this.adapter,
102 this.rooms,
103 exceptRooms,
104 this.flags,
105 );
106 }
107
108 /**
109 * Sets the compress flag.

Callers

nothing calls this directly

Calls 1

addMethod · 0.45

Tested by

no test coverage detected