| 50 | /// Call and spawn [`run`](Self::run) to start processing commands. |
| 51 | #[derive(Debug)] |
| 52 | pub struct ChatServer { |
| 53 | /// Map of connection IDs to their message receivers. |
| 54 | sessions: HashMap<ConnId, mpsc::UnboundedSender<Msg>>, |
| 55 | |
| 56 | /// Map of room name to participant IDs in that room. |
| 57 | rooms: HashMap<RoomId, HashSet<ConnId>>, |
| 58 | |
| 59 | /// Tracks total number of historical connections established. |
| 60 | visitor_count: Arc<AtomicUsize>, |
| 61 | |
| 62 | /// Command receiver. |
| 63 | cmd_rx: mpsc::UnboundedReceiver<Command>, |
| 64 | } |
| 65 | |
| 66 | impl ChatServer { |
| 67 | pub fn new() -> (Self, ChatServerHandle) { |
nothing calls this directly
no outgoing calls
no test coverage detected