Playwriter.Server.Health (Playwriter v0.1.0)

Copy Markdown View Source

Health checking for Playwright server.

Summary

Functions

Check if a Playwright server is responding at the given endpoint.

Wait for server to become available.

Functions

check(ws_endpoint, opts \\ [])

@spec check(
  String.t(),
  keyword()
) :: :ok | {:error, term()}

Check if a Playwright server is responding at the given endpoint.

Options

  • :timeout - Connection timeout in ms (default: 5000)

Examples

:ok = Health.check("ws://localhost:3337/")
{:error, :econnrefused} = Health.check("ws://localhost:9999/")

wait_for(ws_endpoint, opts \\ [])

@spec wait_for(
  String.t(),
  keyword()
) :: :ok | {:error, :timeout}

Wait for server to become available.

Polls the endpoint until it responds or timeout is reached.

Options

  • :timeout - Total timeout in ms (default: 30000)
  • :interval - Poll interval in ms (default: 500)

Examples

:ok = Health.wait_for("ws://localhost:3337/")
{:error, :timeout} = Health.wait_for("ws://localhost:9999/", timeout: 1000)