pub struct ConnectionManager { /* private fields */ }Expand description
Connection manager
Implementations§
Source§impl ConnectionManager
impl ConnectionManager
Sourcepub fn remove(&self, id: &ConnectionId) -> Option<Arc<Connection>>
pub fn remove(&self, id: &ConnectionId) -> Option<Arc<Connection>>
Remove a connection
Sourcepub fn get(&self, id: &ConnectionId) -> Option<Arc<Connection>>
pub fn get(&self, id: &ConnectionId) -> Option<Arc<Connection>>
Get a connection by ID
Sourcepub fn all(&self) -> Vec<Arc<Connection>>
pub fn all(&self) -> Vec<Arc<Connection>>
Get all connections
Sourcepub fn total_connections(&self) -> u64
pub fn total_connections(&self) -> u64
Get total connections served
Sourcepub async fn broadcast(&self, message: Message) -> Result<usize>
pub async fn broadcast(&self, message: Message) -> Result<usize>
Broadcast a message to all connections
Sourcepub async fn broadcast_to(
&self,
ids: &[ConnectionId],
message: Message,
) -> Result<usize>
pub async fn broadcast_to( &self, ids: &[ConnectionId], message: Message, ) -> Result<usize>
Broadcast a message to specific connections
Sourcepub async fn broadcast_filtered<F>(
&self,
message: Message,
filter: F,
) -> Result<usize>
pub async fn broadcast_filtered<F>( &self, message: Message, filter: F, ) -> Result<usize>
Broadcast to connections matching a filter
Sourcepub async fn close_idle(&self, timeout_secs: u64) -> Result<usize>
pub async fn close_idle(&self, timeout_secs: u64) -> Result<usize>
Close idle connections
Sourcepub async fn get_by_room(&self, room: &str) -> Vec<Arc<Connection>>
pub async fn get_by_room(&self, room: &str) -> Vec<Arc<Connection>>
Get connections by room
Sourcepub async fn get_by_topic(&self, topic: &str) -> Vec<Arc<Connection>>
pub async fn get_by_topic(&self, topic: &str) -> Vec<Arc<Connection>>
Get connections by topic
Sourcepub fn subscribe(&self) -> Receiver<ConnectionEvent>
pub fn subscribe(&self) -> Receiver<ConnectionEvent>
Subscribe to connection events
Sourcepub fn stats(&self) -> ConnectionManagerStats
pub fn stats(&self) -> ConnectionManagerStats
Get manager statistics
Auto Trait Implementations§
impl Freeze for ConnectionManager
impl !RefUnwindSafe for ConnectionManager
impl Send for ConnectionManager
impl Sync for ConnectionManager
impl Unpin for ConnectionManager
impl UnsafeUnpin for ConnectionManager
impl !UnwindSafe for ConnectionManager
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