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
Returns the base HTTP URL (e.g. for /json/version).
Returns a specification to start this module under a supervisor.
See Supervisor.
Returns the port number the server is listening on.
Starts a Lightpanda server process.
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:wrapper_script- optional path to a wrapper shell script that re-executes the binary as its first argument. When supplied the Port spawns the wrapper (not the binary directly) with:use_stdioenabled. The wrapper must printPID: <n>on stdout before the child is killed so this server can capture the OS pid forkill -9interminate/2, and must kill the child when its stdin closes. This allows the Lightpanda process to be cleaned up even when the BEAM is killed with SIGKILL (in which caseterminate/2never runs but the Port's stdin pipe closes at the OS level). Seepriv/run_command.shin the wallabidi library for a reference implementation.
Stops the server and the underlying Lightpanda process.
Returns the WebSocket URL for CDP connections.
Blocks until the server is ready, up to the timeout.