Skip to content

Commit f6c8989

Browse files
author
Andrea Cosentino
committed
fix: ws no rooms to broadcast
1 parent 54a9ca0 commit f6c8989

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

src/utils/WebSocket.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,9 @@ export class WebSocketConnection implements IWebSocketConnection {
138138
}
139139

140140
broadcastAllRooms(data: any, includeSelf = false): void {
141+
if (this.rooms.size === 0) {
142+
throw new Error("no rooms provided.");
143+
}
141144
this.rooms.forEach(room => {
142145
this.manager.broadcast(data, { room, excludeId: includeSelf ? undefined : this.id });
143146
});

0 commit comments

Comments
 (0)