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

Introspects `Endpoint.__sockets__/0` (plus explicit `:sockets` / `:socket`
configuration) and routes incoming WebTransport `CONNECT` requests across one
or more Phoenix sockets sharing a single UDP listener.

Features:
  * `Endpoint.__sockets__/0` introspection (`websocket` and optional `webtransport`
    options, skipping `Phoenix.LiveReloader.Socket` by default)
  * Multi-socket mounting on one listener (e.g. `"/live"` and `"/socket"`)
  * Exact, parameter (`"/tenant/:org/live"`), and glob (`"/room/*rest"`) path
    matching matching `Plug.Router` semantics while accepting both the mount
    path (`/live`) and the transport suffix (`/live/webtransport`)
  * Dev `Phoenix.CodeReloader.reload/1` execution parity on upgrade

# `route`

```elixir
@type route() :: %PhoenixWebTransport.Router.Route{
  endpoint: term(),
  max_frame_size: term(),
  max_in_buf_bytes: term(),
  max_lanes: term(),
  mount_path: term(),
  pattern: term(),
  socket: term(),
  socket_opts: term(),
  subpath: term(),
  subpath_segments: term()
}
```

# `compile`

```elixir
@spec compile(keyword()) :: [route()]
```

Compiles a list of routes from listener or engine options.

# `match`

```elixir
@spec match([route()], binary()) :: {:ok, route(), map()} | :error
```

Matches an incoming request path against compiled routes, returning
`{:ok, route, path_params}` or `:error`.

# `maybe_code_reload`

```elixir
@spec maybe_code_reload(module(), keyword()) :: :ok
```

Triggers code reloading when `:code_reloader` is enabled in route options or
on `endpoint.config(:code_reloader)`.

---

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