Skip to main content

vcl_protocol/
event.rs

1use std::time::Duration;
2
3/// Events emitted by VCLConnection.
4/// Subscribe via `connection.subscribe()` to receive an async channel.
5#[derive(Debug, Clone)]
6pub enum VCLEvent {
7    /// Handshake completed — connection is ready
8    Connected,
9    /// Connection was closed (via close())
10    Disconnected,
11    /// A data packet was received
12    PacketReceived { sequence: u64, size: usize },
13    /// Peer sent us a Ping — we responded with Pong automatically
14    PingReceived,
15    /// Pong received in response to our ping, with measured round-trip latency
16    PongReceived { latency: Duration },
17    /// Key rotation completed successfully (both sides switched to new key)
18    KeyRotated,
19    /// A non-fatal error occurred internally
20    Error(String),
21}