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

Method send_message

websockets/chat/src/server.rs:93–103  ·  view source on GitHub ↗

Send message to all users in the room

(&self, room: &str, message: &str, skip_id: u64)

Source from the content-addressed store, hash-verified

91impl ChatServer {
92 /// Send message to all users in the room
93 fn send_message(&self, room: &str, message: &str, skip_id: u64) {
94 if let Some(sessions) = self.rooms.get(room) {
95 for id in sessions {
96 if *id != skip_id {
97 if let Some(addr) = self.sessions.get(id) {
98 addr.do_send(Message(message.to_owned()));
99 }
100 }
101 }
102 }
103 }
104}
105
106/// Make actor from `ChatServer`

Callers 2

echo_wsFunction · 0.45
handleMethod · 0.45

Calls 2

getMethod · 0.80
MessageClass · 0.70

Tested by

no test coverage detected