Expand description
WebSocket — a captured WebSocket connection, reconstructed from CDP
Network.webSocket* events.
CDP does not expose a live WebSocket object; instead the Network domain
emits a lifecycle of events for each connection, keyed by requestId:
Network.webSocketCreated— the URL (and optional request).Network.webSocketWillSendHandshakeRequest— outgoing request headers.Network.webSocketHandshakeResponseReceived— status code + response headers.Network.webSocketFrameSent— a frame the page sent.Network.webSocketFrameReceived— a frame the page received.Network.webSocketFrameError— a protocol error.Network.webSocketClosed— the connection closed (with a timestamp).
WebSocketRegistry subscribes to the page session, partitions events by
requestId, and accumulates them into one WebSocket per connection. The
page-side page.on('websocket') wiring (and the WebSocket::new the page
would hand callers) arrives in a later wave — this module provides the type
and the capture/registry logic only.
The accumulated WebSocket is cheaply cloneable (Arc<Inner>); clones share
the same live state, so frames arriving after the handle is handed out are
visible via frames and the on_* handlers.
Structs§
- WebSocket
- A captured WebSocket connection.
- WebSocket
Close Info - Information about a closed WebSocket connection.
- WebSocket
Frame - A single WebSocket frame payload, tagged with its direction.
- WebSocket
Handshake - The WebSocket handshake result.
- WebSocket
Registry - A registry that captures WebSocket connections from a page session.
Enums§
- Frame
Data - A frame’s payload, distinguishing text from binary.
- Frame
Direction - Direction of a
WebSocketFrame. - Wait
Error - Errors from
WebSocket::wait_for_event. - WebSocket
Live Event - A live event emitted on a
WebSocket’s broadcast bus.