Owns the set of live rooms, creating them on demand and dropping them once empty.
RoomRegistry(publish?: RoomPublisher,onMemberJoined?: () => void)
publish: RoomPublisher
Forwards every room broadcast to other replicas. Omit for purely in-process rooms, which is the behavior when no backplane capability is registered.
size: number
Number of live rooms.
clear(): void
Discards every room.
deliverRemote(): void
Delivers a frame that arrived from another replica to this replica's local members.
A room is looked up but never CREATED here. A remote frame naming a room nobody on this replica has joined has no local audience, and creating one per arriving name would let a cluster-wide namespace grow this replica's room map without bound.
evict(conn: IWebSocketConnection): void
Removes a connection from every room it belongs to, then discards any room left empty.
Costs O(rooms this connection is in) rather than O(all rooms), which for the overwhelmingly common case — a peer in no rooms at all — is a single failed map lookup.
Returns the named room if one already exists, without creating it.
The non-allocating counterpart to RoomRegistry.get. It is a
bare map read by design: it must not touch RoomRegistry.#neverJoined
in either direction, because adding to that set would mark a room already
in use as abandoned, and reclaiming from it on a read path would make a
lookup that promises to change nothing dispose rooms.