pub enum AccountedRawEvent {
Event {
generation: u64,
sequence: u64,
event: RawEvent,
},
Lagged {
generation: u64,
missed: u64,
},
Reconnected {
previous: u64,
generation: u64,
},
Disconnected {
generation: u64,
},
}Expand description
Loss-accounted event as delivered by
Connection::subscribe_raw_accounted.
Connection::subscribe_raw
silently drops any RawEvent a lagging subscriber missed and has no way
to signal a reconnect or a dead socket. That is fine for the lenient
default, but a capture/replay/monitor consumer built on top of it is
silently misled about what it actually saw. AccountedRawEvent is the
opt-in, honest alternative: every gap, reconnect, and disconnect is
reported explicitly instead of vanishing.
Every variant carries a generation — the
Connection::connection_generation
active when the variant was produced. generation starts at 1 and
bumps by one on every
Connection::reconnect; each
generation gets its own sequence counter, restarted at 1.
Variants§
Event
A CDP event delivered in order.
Fields
sequence: u64Monotonic, per-generation position of this event, starting at 1.
Within a single generation, a gap between two observed sequence
values equals the missed count of an intervening
AccountedRawEvent::Lagged — sequence resumes after a loss
rather than resetting. Do NOT compare sequence across a
AccountedRawEvent::Reconnected: the counter restarts at 1 for
the new generation, and a Lagged’s missed may also count the
non-sequenced Reconnected/Disconnected markers, so only
same-generation values are comparable.
Lagged
This subscriber fell behind the broadcast bus and missed missed
events that were subsequently overwritten. Unlike
Connection::subscribe_raw,
which drops lagged frames without a trace, this variant surfaces the
loss explicitly so a consumer can decide how to react (resync, alert,
abort) instead of silently missing data.
Fields
Reconnected
The connection re-established a fresh WebSocket via
Connection::reconnect.
sequence resets to 1 for the new generation.
Fields
Disconnected
The underlying WebSocket died unexpectedly — a Chrome-sent Close
frame, a read/write error, or the stream ending — as opposed to a
caller-requested
Connection::shutdown or
a Connection::reconnect.
Emitted exactly once per generation’s genuine death; a shutdown or a
reconnect never produces this variant.
Trait Implementations§
Source§impl Clone for AccountedRawEvent
impl Clone for AccountedRawEvent
Source§fn clone(&self) -> AccountedRawEvent
fn clone(&self) -> AccountedRawEvent
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more