feat: rooms broadcast-hub primitive, auto-provided to handlers

Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
This commit is contained in:
chrnx committed 2026-06-28 13:23:54 -05:00
1 parent 2bbc43505e
commit 6171e5e6bd
5 files changed
+68

No files matched your search

+11
View File
@@ -0,0 +1,11 @@
import { channel, type Channel } from './channel';
export class Rooms {
private readonly hubs = new Map<string, Channel<unknown>>();
room<T = unknown>(name: string): Channel<T> {
let hub = this.hubs.get(name);
if (!hub) { hub = channel<unknown>(); this.hubs.set(name, hub); }
return hub as unknown as Channel<T>;
}
names(): string[] { return [...this.hubs.keys()]; }
}