Skip to main content

Module transport

Module transport 

Source
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.
RequestError
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_TIMEOUT on the CDP side and SEND_TIMEOUT on 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.