Skip to main content

Crate cdp_server

Crate cdp_server 

Source

Re-exports§

pub use bao_event::BaoEvent;
pub use bao_event::ConsoleMessage;

Modules§

bao_event

Structs§

CdpError
CDP error object.
CdpEvent
CDP event notification (no id field).
CdpMessage
Incoming CDP/JSON-RPC 2.0 request.
CdpResponse
Outgoing CDP/JSON-RPC 2.0 response.
CdpServer
CdpSession
CDP client session. Holds a WebSocket connection and tracks enabled domains.
DomainRegistry
Registry of CDP domain handlers. Thread-safe (Mutex-protected). Generic over handler type H — enables enum dispatch (H=DomainDispatch) for zero-vtable overhead.
EmptyHandler
Empty handler used as the default registry type when no domains are needed. CdpServer::new() creates a DomainRegistry<EmptyHandler> internally; production code should use CdpServer::with_registry() with a concrete handler type (e.g. DomainDispatch).
EventBroadcaster
EventBroadcaster implements EventSender. It holds a reference to the session map and queues events into per-session outboxes; the server loop drains the outboxes into the WebSocket while holding the session lock.
ServerConfig
CDP server configuration. Controls bind address, timeouts, concurrency limits and version strings.
ServerConfigBuilder
SessionHandle
Shared session handle: the session itself plus its outbound event queue.
TargetInfo
Browser Target information.

Enums§

SessionError
Session-level I/O error (replaces unit () error types).
SessionState
Session lifecycle states (SM-CDP-SESSION).

Constants§

ERR_INTERNAL
ERR_INVALID_PARAMS
ERR_INVALID_REQUEST
ERR_METHOD_NOT_FOUND
ERR_PARSE_ERROR

Traits§

DomainHandler
CDP Domain handler trait. Each implementation handles one CDP domain (e.g. Page, Runtime, DOM). All browser-specific logic lives here.
EventSender
Event sender trait. Implemented internally by cdp-server, injected into DomainHandlers so they can broadcast CDP events.
RegistryDispatch
Type-erased dispatch trait. CdpServer holds Arc<dyn RegistryDispatch> so it works with any DomainRegistry<H> regardless of H.
TargetProvider
Browser target manager trait. Implemented by the backend (e.g. bao_cdp) to provide target discovery/creation/closure.

Functions§

error_response
is_websocket_upgrade
Parse the request to determine if it’s a WebSocket upgrade. Returns the pre-read bytes for replay.
ok_empty
ok_response
parse_activate_request
parse_close_request
Parse HTTP path for target actions. Returns (action, target_id).
parse_message
parse_new_request
serialize_event
serialize_response

Type Aliases§

SharedRegistry
Shared registry type used by CdpServer — type-erased via RegistryDispatch.