pub struct WebSocketConnectionStats {
pub messages_sent: u64,
pub messages_received: u64,
pub pings_sent: u64,
pub pongs_received: u64,
pub connection_errors: u64,
pub reconnection_attempts: u64,
pub connection_state: TransportState,
pub connected_at: Option<SystemTime>,
pub last_activity: Option<SystemTime>,
}Expand description
Connection statistics for monitoring
Fields§
§messages_sent: u64Number of messages sent
messages_received: u64Number of messages received
pings_sent: u64Number of ping messages sent
pongs_received: u64Number of pong messages received
connection_errors: u64Number of connection errors
reconnection_attempts: u64Number of reconnection attempts
connection_state: TransportStateCurrent connection state
connected_at: Option<SystemTime>Time when connection was established
last_activity: Option<SystemTime>Time of last message activity
Implementations§
Source§impl WebSocketConnectionStats
impl WebSocketConnectionStats
Sourcepub fn record_message_sent(&mut self)
pub fn record_message_sent(&mut self)
Record a sent message
Sourcepub fn record_message_received(&mut self)
pub fn record_message_received(&mut self)
Record a received message
Sourcepub fn record_ping_sent(&mut self)
pub fn record_ping_sent(&mut self)
Record a sent ping
Sourcepub fn record_pong_received(&mut self)
pub fn record_pong_received(&mut self)
Record a received pong
Sourcepub fn record_connection_error(&mut self)
pub fn record_connection_error(&mut self)
Record a connection error
Sourcepub fn record_reconnection_attempt(&mut self)
pub fn record_reconnection_attempt(&mut self)
Record a reconnection attempt
Sourcepub fn set_connection_state(&mut self, state: TransportState)
pub fn set_connection_state(&mut self, state: TransportState)
Set connection state
Trait Implementations§
Source§impl Clone for WebSocketConnectionStats
impl Clone for WebSocketConnectionStats
Source§fn clone(&self) -> WebSocketConnectionStats
fn clone(&self) -> WebSocketConnectionStats
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 moreSource§impl Debug for WebSocketConnectionStats
impl Debug for WebSocketConnectionStats
Auto Trait Implementations§
impl Freeze for WebSocketConnectionStats
impl RefUnwindSafe for WebSocketConnectionStats
impl Send for WebSocketConnectionStats
impl Sync for WebSocketConnectionStats
impl Unpin for WebSocketConnectionStats
impl UnsafeUnpin for WebSocketConnectionStats
impl UnwindSafe for WebSocketConnectionStats
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