Skip to main content

Module room

Module room 

Source
Expand description

Room-based group messaging.

RoomManager owns a DashMap of Rooms. Each Room is an isolated broadcast domain with a participant roster keyed by connection id (u32) mapping to a display name (String).

Since 0.4.0 rooms carry Frame payloads — both text and binary — instead of bare Strings. Existing room.broadcast(text_string) call sites keep compiling (String: Into<Frame>, zero-copy move); binary payloads broadcast via room.broadcast(bytes). Subscribers now receive Frames: match on the variant, or use Frame::into_text to restore the old behavior for text-only consumers.

§The RoomRegistry trait

RoomManager implements RoomRegistry, the in-memory single-node registry. Multi-node deployments swap in crate::redis_rooms::RedisRoomRegistry (feature redis), which implements the same trait for the local half while fanning broadcasts out through Redis pub/sub.

Structs§

Room
A single broadcast room with a participant roster.
RoomManager
Manages a collection of Rooms.

Traits§

RoomRegistry
Storage for rooms, abstracted so a room collection can be swapped without changing room/messaging code (0.4.0).