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

Graceful shutdown drainer started after the listener inside
`PhoenixWebTransport.Supervisor`.

Because OTP supervises children in reverse startup order on termination, this
process's `terminate/2` runs *before* the QUIC listener stops: it signals every
registered WebTransport session in batches (`:phoenix_wt_drain`), emits
`[:phoenix_wtransport, :drain]` telemetry, and waits for active sessions to
send `DRAIN_WEBTRANSPORT_SESSION` + `1012` close capsules within
`:drain_timeout`.

# `child_spec`

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

Child specification with shutdown timeout covering drain execution.

# `sessions`

```elixir
@spec sessions(GenServer.server()) :: [pid()]
```

Lists live registered session pids tracked by `drainer`.

# `start_link`

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

Starts the drainer process.

---

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