pub struct ClientManager { /* private fields */ }Expand description
Manages all connected WebSocket clients
Implementations§
Source§impl ClientManager
impl ClientManager
pub fn new() -> Self
pub fn with_timeout(self, timeout: Duration) -> Self
pub fn with_message_queue_size(self, queue_size: usize) -> Self
Sourcepub async fn add_client(
&self,
client_id: Uuid,
ws_sender: WebSocketSender,
) -> Result<()>
pub async fn add_client( &self, client_id: Uuid, ws_sender: WebSocketSender, ) -> Result<()>
Add a new client connection
pub async fn remove_client(&self, client_id: Uuid)
pub async fn client_count(&self) -> usize
pub async fn send_to_client( &self, client_id: Uuid, data: Arc<Bytes>, ) -> Result<()>
pub async fn update_subscription( &self, client_id: Uuid, subscription: Subscription, ) -> bool
pub async fn update_client_last_seen(&self, client_id: Uuid)
pub async fn get_subscription(&self, client_id: Uuid) -> Option<Subscription>
pub async fn cleanup_stale_clients(&self) -> usize
pub async fn start_cleanup_task(&self)
Trait Implementations§
Source§impl Clone for ClientManager
impl Clone for ClientManager
Source§fn clone(&self) -> ClientManager
fn clone(&self) -> ClientManager
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for ClientManager
impl !RefUnwindSafe for ClientManager
impl Send for ClientManager
impl Sync for ClientManager
impl Unpin for ClientManager
impl !UnwindSafe for ClientManager
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more