pub struct HeartbeatMonitor { /* private fields */ }Expand description
Heartbeat monitor for WebSocket connections
Implementations§
Source§impl HeartbeatMonitor
impl HeartbeatMonitor
Sourcepub fn new(
heartbeat_interval_milliseconds: u64,
heartbeat_timeout_milliseconds: u64,
max_missed_heartbeats: u32,
connection_status: Arc<RwLock<ConnectionState>>,
stats: Arc<RwLock<ConnectionStats>>,
) -> Self
pub fn new( heartbeat_interval_milliseconds: u64, heartbeat_timeout_milliseconds: u64, max_missed_heartbeats: u32, connection_status: Arc<RwLock<ConnectionState>>, stats: Arc<RwLock<ConnectionStats>>, ) -> Self
Create a new heartbeat monitor
Sourcepub fn update_last_message_time(&self)
pub fn update_last_message_time(&self)
Update the last message time
Sourcepub fn check_heartbeat(&self) -> HeartbeatStatus
pub fn check_heartbeat(&self) -> HeartbeatStatus
Check the heartbeat status
Sourcepub fn missed_heartbeats(&self) -> u32
pub fn missed_heartbeats(&self) -> u32
Get the number of consecutive missed heartbeats
Sourcepub fn time_since_last_message(&self) -> Duration
pub fn time_since_last_message(&self) -> Duration
Get the time elapsed since the last message
Trait Implementations§
Source§impl Clone for HeartbeatMonitor
impl Clone for HeartbeatMonitor
Source§fn clone(&self) -> HeartbeatMonitor
fn clone(&self) -> HeartbeatMonitor
Returns a duplicate of the value. Read more
1.0.0 · Source§const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for HeartbeatMonitor
impl !RefUnwindSafe for HeartbeatMonitor
impl Send for HeartbeatMonitor
impl Sync for HeartbeatMonitor
impl Unpin for HeartbeatMonitor
impl !UnwindSafe for HeartbeatMonitor
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