* Targets a room when emitting. * * @param room * @return a new BroadcastOperator instance * @public
(
room: string | string[],
)
| 265 | * @public |
| 266 | */ |
| 267 | public to( |
| 268 | room: string | string[], |
| 269 | ): BroadcastOperator<EmitEvents, ServerSideEvents> { |
| 270 | const rooms = new Set(this.rooms); |
| 271 | if (Array.isArray(room)) { |
| 272 | room.forEach((r) => rooms.add(r)); |
| 273 | } else { |
| 274 | rooms.add(room); |
| 275 | } |
| 276 | return new BroadcastOperator( |
| 277 | this.emitter, |
| 278 | rooms, |
| 279 | this.exceptRooms, |
| 280 | this.flags, |
| 281 | ); |
| 282 | } |
| 283 | |
| 284 | /** |
| 285 | * Targets a room when emitting. |