mirror of
https://gitlab.com/comunic/comunicapiv3
synced 2025-09-25 22:29:45 +00:00
Can leave a call
This commit is contained in:
@@ -119,8 +119,8 @@ mod ws_connections_list {
|
||||
continue;
|
||||
}
|
||||
|
||||
do_update(&mut self);
|
||||
list[i] = self.clone();
|
||||
do_update(&mut list[i]);
|
||||
self = list[i].clone();
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -324,7 +324,12 @@ impl Actor for WsSession {
|
||||
}
|
||||
|
||||
fn stopping(&mut self, ctx: &mut Self::Context) -> Running {
|
||||
// TODO : send an event (user_ws_closed)
|
||||
// Send an event (user_ws_closed)
|
||||
if let Some(conn) = find_connection(ctx.address()) {
|
||||
if let Err(e) = events_helper::propagate_event(&Event::UserWsClosed(&conn)) {
|
||||
eprintln!("Failed to propagate web socket closed event ! {:#?}", e);
|
||||
}
|
||||
}
|
||||
|
||||
remove_connection(ctx.address());
|
||||
Running::Stop
|
||||
@@ -490,6 +495,11 @@ pub fn send_message_to_user(msg: &UserWsMessage, user: &UserID) -> Res {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Send a message to a specific connection
|
||||
pub fn send_to_client(conn: &UserWsConnection, msg: &UserWsMessage) -> Res {
|
||||
send_message(conn.session.clone(), msg)
|
||||
}
|
||||
|
||||
/// Send a message to specific users
|
||||
pub fn send_message_to_specific_connections<F, M, A>(filter: F, msg_generator: M, after_send: Option<A>) -> Res
|
||||
where F: Fn(&UserWsConnection) -> bool,
|
||||
|
Reference in New Issue
Block a user