mirror of
https://gitlab.com/comunic/comunicapiv3
synced 2025-09-25 22:29:45 +00:00
Can register / unregister a conversation
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
//!
|
||||
//! Handles the WebSocket offered to the users
|
||||
|
||||
use std::collections::HashMap;
|
||||
use std::collections::{HashMap, HashSet};
|
||||
use std::time::{Duration, Instant};
|
||||
|
||||
use actix::{Actor, ActorContext, Addr, AsyncContext, Handler, Running, StreamHandler};
|
||||
@@ -99,12 +99,14 @@ mod ws_tokens_list {
|
||||
|
||||
/// WebSocket connections list
|
||||
mod ws_connections_list {
|
||||
use std::collections::HashSet;
|
||||
use std::sync::Arc;
|
||||
use std::sync::Mutex;
|
||||
|
||||
use actix::Addr;
|
||||
|
||||
use crate::controllers::user_ws_controller::WsSession;
|
||||
use crate::data::conversation::ConvID;
|
||||
use crate::data::user::UserID;
|
||||
|
||||
/// This structure contains information about an active connection
|
||||
@@ -115,6 +117,7 @@ mod ws_connections_list {
|
||||
pub remote_ip: String,
|
||||
pub session: actix::Addr<WsSession>,
|
||||
pub incognito: bool,
|
||||
pub conversations: HashSet<ConvID>,
|
||||
}
|
||||
|
||||
impl WsConnection {
|
||||
@@ -326,6 +329,7 @@ impl Actor for WsSession {
|
||||
remote_ip: self.remote_ip.clone(),
|
||||
session: ctx.address(),
|
||||
incognito: self.incognito,
|
||||
conversations: HashSet::new(),
|
||||
})
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user