Expand description
Shared WebSocket JSON-RPC transport (WsRpc) used by both the CDP and
BiDi clients.
CDP and BiDi are two JSON-RPC-over-WebSocket dialects with identical
connect / writer-task / reader-frame-decode / pending-correlation /
next_id / broadcast / timeout-ladder machinery. They previously each
reimplemented all of it, and the two copies had drifted in ways that were
genuine bugs on the BiDi side (pending entries leaked on writer failure;
no typed disconnect error; no close(), no stored JoinHandles, so
dropping a cached client orphaned parked reader tasks). This module is the
single shared implementation; the protocol-specific framing/typing stays in
crate::cdp / crate::bidi via the Protocol trait.
The constants that had drifted (REQUEST_TIMEOUT vs SEND_TIMEOUT, the
event-channel capacity, the connect timeout) are converged here.
Structs§
- WsRpc
- Shared JSON-RPC-over-WebSocket transport. Owns the socket, the reader and
writer tasks (and their
JoinHandles), the pending-request correlation map, the id counter, and the event broadcast channel.
Enums§
- Decoded
- Outcome of decoding one inbound frame.
- Request
Error - Result of a
WsRpc::request: either a protocol error reply, or a transport-level fault (timeout / writer closed / serialization).
Constants§
- CONNECT_
TIMEOUT - Bound on
connect_async/ HTTP discovery during initial bringup. - EVENT_
CHANNEL_ CAPACITY - Capacity of the per-client event broadcast channel.
- REQUEST_
TIMEOUT - Per-request reply timeout. One value for both protocols (previously
REQUEST_TIMEOUTon the CDP side andSEND_TIMEOUTon the BiDi side, both 30s).
Traits§
- Protocol
- Protocol adapter: the dialect-specific framing/typing that the shared transport delegates to. CDP and BiDi each implement this; everything else (socket, tasks, correlation, timeouts, lifecycle) is shared.