pub struct Awareness { /* private fields */ }Expand description
Awareness manager tracking all client states
Implementations§
Source§impl Awareness
impl Awareness
Sourcepub fn get_states(&self) -> &HashMap<String, AwarenessState>
pub fn get_states(&self) -> &HashMap<String, AwarenessState>
Get all current client states
Sourcepub fn get_state(&self, client_id: &str) -> Option<&AwarenessState>
pub fn get_state(&self, client_id: &str) -> Option<&AwarenessState>
Get state for a specific client
Sourcepub fn get_local_state(&self) -> Option<&AwarenessState>
pub fn get_local_state(&self) -> Option<&AwarenessState>
Get local client’s state
Sourcepub fn set_local_state(&mut self, state: Value) -> AwarenessUpdate
pub fn set_local_state(&mut self, state: Value) -> AwarenessUpdate
Set local client’s state (returns update to broadcast)
Sourcepub fn apply_update(&mut self, update: AwarenessUpdate)
pub fn apply_update(&mut self, update: AwarenessUpdate)
Apply remote awareness update
Sourcepub fn remove_stale_clients(&mut self, timeout: Duration) -> Vec<String>
pub fn remove_stale_clients(&mut self, timeout: Duration) -> Vec<String>
Remove clients that haven’t updated within timeout Returns list of removed client IDs
Sourcepub fn create_leave_update(&self) -> AwarenessUpdate
pub fn create_leave_update(&self) -> AwarenessUpdate
Create update to signal local client leaving
Sourcepub fn client_count(&self) -> usize
pub fn client_count(&self) -> usize
Get number of online clients (including self)
Sourcepub fn other_client_count(&self) -> usize
pub fn other_client_count(&self) -> usize
Get number of online clients excluding self