# `PhoenixWebTransport`
[🔗](https://github.com/knevan/phoenix-wtransport/blob/main/lib/phoenix_wtransport.ex#L1)

WebTransport (HTTP/3 over QUIC) as a transport for Phoenix sockets and
LiveView, with one QUIC stream per LiveView component and
shortest-message-first scheduling.

Add `{PhoenixWebTransport, endpoint: MyAppWeb.Endpoint}` (or
`PhoenixWebTransport.Supervisor` / `PhoenixWebTransport.Quic.Listener`) to
your supervision tree next to the endpoint:

  * Pure-Erlang QUIC + HTTP/3 on `benoitc/erlang_quic` (zero native builds)
  * Optional `socket_backend: :socket` for OTP `socket` NIF (GRO/GSO on Linux)

Listeners register here (unless `register: false`), so pages and
`PhoenixWebTransport.Plug` can read `url/0`, `port/0`, and `cert_hash/0`.

# `cert_hash`

```elixir
@spec cert_hash() :: String.t() | nil
```

Hex SHA-256 of the served dev cert for `serverCertificateHashes`, or nil.

# `child_spec`

```elixir
@spec child_spec(keyword()) :: Supervisor.child_spec()
```

Child specification delegating to `PhoenixWebTransport.Supervisor`.

# `enabled?`

```elixir
@spec enabled?() :: boolean()
```

Whether a WebTransport listener is running in this VM.

# `path_stats`

```elixir
@spec path_stats(GenServer.server()) :: {:ok, map()} | {:error, term()}
```

Returns QUIC path metrics (`srtt`, `cwnd`, `congested`, etc.) for a session.

# `port`

```elixir
@spec port() :: :inet.port_number() | nil
```

The UDP port of the registered WebTransport listener, or nil.

# `send_datagram`

```elixir
@spec send_datagram(GenServer.server(), iodata(), keyword()) :: :ok
```

Sends an opt-in RFC 9297 unreliable datagram (with automatic lane-0 fallback).

# `session_info`

```elixir
@spec session_info(GenServer.server()) :: {:ok, map()} | {:error, term()}
```

Returns runtime diagnostics for a live WebTransport session process.

# `set_congestion_control`

```elixir
@spec set_congestion_control(GenServer.server(), :bbr | :cubic | :newreno) ::
  :ok | {:error, term()}
```

Switches congestion control (`:bbr | :cubic | :newreno`) on a live session.

# `set_stream_deadline`

```elixir
@spec set_stream_deadline(
  GenServer.server(),
  non_neg_integer(),
  pos_integer(),
  keyword()
) ::
  :ok | {:error, term()}
```

Sets an opt-in send deadline (`timeout_ms`) on a lane or slot.

# `start_link`

```elixir
@spec start_link(keyword()) :: Supervisor.on_start()
```

Starts `PhoenixWebTransport.Supervisor` with the given options.

# `url`

```elixir
@spec url() :: String.t() | nil
```

The URL pages should hand to `LiveSocket`, or nil when no listener runs.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
