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

Optional Phoenix Endpoint / Router `Plug` for HTTP/3 discovery and
cookie-less WebTransport session token minting.

Features:
  * Advertises the active WebTransport/HTTP3 port via `Alt-Svc` headers
  * Serves `POST /_wt/token` (configurable) using the browser's normal Plug
    session cookie to mint a short-lived signed `PhoenixWebTransport.Token`
    without exposing raw cookies or tokens in query strings

## Example

    # In MyAppWeb.Endpoint (after Plug.Session, before MyAppWeb.Router)
    plug PhoenixWebTransport.Plug,
      token_path: "/_wt/token",
      claims: fn conn ->
        case Plug.Conn.get_session(conn, :current_user_id) do
          nil -> {:error, :unauthorized}
          user_id -> {:ok, %{"user_id" => user_id, "live_socket_id" => Plug.Conn.get_session(conn, "live_socket_id")}}
        end
      end

---

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