Lightpanda.Server (lightpanda v0.2.10-rc.1)

Copy Markdown View Source

A GenServer that manages a Lightpanda browser process.

Starts the binary in serve mode on an automatically-assigned port, waits for it to be ready, and provides the WebSocket URL for CDP connections.

Usage

{:ok, pid} = Lightpanda.Server.start_link()
ws_url = Lightpanda.Server.ws_url(pid)
# => "ws://127.0.0.1:52431"

Options

  • :host - the host to bind to (default: "127.0.0.1")
  • :port - the port to bind to (default: automatically assigned)
  • :extra_args - additional CLI arguments to pass to the binary
  • :name - GenServer name registration

Summary

Functions

Returns the base HTTP URL (e.g. for /json/version).

Returns a specification to start this module under a supervisor.

Returns the port number the server is listening on.

Starts a Lightpanda server process.

Stops the server and the underlying Lightpanda process.

Returns the WebSocket URL for CDP connections.

Functions

base_url(server, timeout \\ 10000)

Returns the base HTTP URL (e.g. for /json/version).

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

port(server, timeout \\ 10000)

Returns the port number the server is listening on.

start_link(opts \\ [])

Starts a Lightpanda server process.

stop(server)

Stops the server and the underlying Lightpanda process.

ws_url(server, timeout \\ 10000)

Returns the WebSocket URL for CDP connections.

Blocks until the server is ready, up to the timeout.