WebSocket client for the Chrome DevTools Protocol.
Manages a single WebSocket connection to a CDP endpoint, dispatching commands with auto-incrementing IDs and routing responses/events back to callers.
Typically not used directly — LightCDP.start/1 handles connection setup.
Low-level usage
{:ok, conn} = LightCDP.Connection.open("http://127.0.0.1:9222")
{:ok, result} = LightCDP.Connection.send_command(conn, "Browser.getVersion")
LightCDP.Connection.close(conn)
Summary
Functions
Blocks until the event registered with register_event_waiter/2 fires.
Closes the WebSocket connection.
Connects to a CDP endpoint.
Registers a waiter for a CDP event. Returns a ref to pass to await_event/2.
Sends a CDP command and waits for the response.
Waits for a CDP event by method name.
Functions
Blocks until the event registered with register_event_waiter/2 fires.
Returns {:ok, params} or {:error, %LightCDP.TimeoutError{}}.
Closes the WebSocket connection.
Connects to a CDP endpoint.
Fetches the WebSocket URL from {endpoint}/json/version, then opens
a WebSocket connection.
Returns {:ok, pid} or {:error, %LightCDP.ConnectionError{}}.
Registers a waiter for a CDP event. Returns a ref to pass to await_event/2.
Register before triggering the action that produces the event to avoid race conditions.
Sends a CDP command and waits for the response.
Returns {:ok, result}, {:error, %LightCDP.CDPError{}}, or
{:error, %LightCDP.TimeoutError{}}.
session_id is required for commands targeting a specific page/target
(anything after Target.attachToTarget).
Waits for a CDP event by method name.
Combines register_event_waiter/2 and await_event/2.