MCPcopy Create free account
hub / github.com/actix/examples / ChatServer

Class ChatServer

websockets/chat-actorless/src/server.rs:52–64  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

50/// Call and spawn [`run`](Self::run) to start processing commands.
51#[derive(Debug)]
52pub 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
66impl ChatServer {
67 pub fn new() -> (Self, ChatServerHandle) {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected