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

One WebTransport session on `erlang_quic`, driving a `Phoenix.Socket.Transport`
via `PhoenixWebTransport.SessionEngine` and `PhoenixWebTransport.LaneScheduler`.

The process is the HTTP/3 connection's owner, so it receives the extended
CONNECT request, the claimed WebTransport streams, datagrams, and the CONNECT
stream's capsules. It is also the Phoenix transport pid, so channel pushes
arrive here as messages and go out on QUIC streams, one per lane slot, with
RFC 9218 urgency caching and congestion-aware watermark pacing.

# `child_spec`

```elixir
@spec child_spec({pid(), keyword()}) :: Supervisor.child_spec()
```

Child specification for starting a session under a `DynamicSupervisor`.

# `options`

```elixir
@spec options(keyword()) :: keyword()
```

Options accepted by this listener. `:memory_budget` is a
`PhoenixWebTransport.MemoryBudget` tuple shared by every session on this
listener (see `PhoenixWebTransport.Supervisor`).

# `path_stats`

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

Returns QUIC path metrics (`:quic.get_path_stats/1`) for the session.

# `send_datagram`

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

Sends an opt-in RFC 9297 datagram (falling back to control lane 0 if needed).

# `session_info`

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

Returns runtime diagnostics for a live `Quic.Session`.

# `set_congestion_control`

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

Switches the QUIC congestion control algorithm (`:bbr | :cubic | :newreno`).

# `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 (`:quic.set_stream_deadline/4`) on a lane or slot.

# `start`

```elixir
@spec start(pid(), keyword()) :: GenServer.on_start()
```

Starts an unlinked WebTransport session process.

# `start_link`

```elixir
@spec start_link({pid(), keyword()}) :: GenServer.on_start()
```

Starts a supervised WebTransport session process linked to its supervisor.

---

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