Send message to users in a room. `skip` is used to prevent messages triggered by a connection also being received by it.
(&self, room: &str, skip: ConnId, msg: impl Into<Msg>)
| 88 | /// |
| 89 | /// `skip` is used to prevent messages triggered by a connection also being received by it. |
| 90 | async fn send_system_message(&self, room: &str, skip: ConnId, msg: impl Into<Msg>) { |
| 91 | if let Some(sessions) = self.rooms.get(room) { |
| 92 | let msg = msg.into(); |
| 93 | |
| 94 | for conn_id in sessions { |
| 95 | if *conn_id != skip |
| 96 | && let Some(tx) = self.sessions.get(conn_id) |
| 97 | { |
| 98 | // errors if client disconnected abruptly and hasn't been timed-out yet |
| 99 | let _ = tx.send(msg.clone()); |
| 100 | } |
| 101 | } |
| 102 | } |
| 103 | } |
| 104 | |
| 105 | /// Send message to all other users in current room. |
| 106 | /// |
no test coverage detected