# `MuroPlug.PhoenixAdapter`
[🔗](https://github.com/murolang/muro_plug/blob/main/lib/muro_plug/phoenix_adapter.ex#L1)

A `Phoenix.Endpoint` adapter for MuroPlug, shaped like
`Bandit.PhoenixAdapter`.

    config :my_app, MyAppWeb.Endpoint,
      adapter: MuroPlug.PhoenixAdapter,
      http: [ip: {127, 0, 0, 1}, port: 4000],
      https: [
        ip: {127, 0, 0, 1},
        port: 4040,
        certfile: "priv/cert/selfsigned.pem",
        keyfile: "priv/cert/selfsigned_key.pem"
      ]

The `:http` and `:https` keyword lists are each passed to
`MuroPlug.child_spec/1` (`:port`, `:ip`, `:max_body`,
`:idle_timeout`, `:thousand_island_options`, and for `:https` the TLS
options listed there). Either or both may be set: each one is its
own MuroPlug server under the endpoint's supervisor, with child id
`{endpoint, scheme}`. Relative TLS file paths in `:https` resolve
against the endpoint's `:otp_app`, as in Plug.Cowboy and Bandit.

WebSockets work on either scheme (`ws://` and `wss://`): Phoenix's
socket transport calls `WebSockAdapter.upgrade/4`, which hands
`{socket_module, state, opts}` to `MuroPlug.Adapter.upgrade/3`, so
`Phoenix.Socket` channels and LiveView run on MuroPlug. The endpoint's
`websocket:` options (`:timeout`, `:max_frame_size`, `:compress`,
...) are the ones listed in `MuroPlug.WebSocket`.

# `server_info`

The bound address and port, for `Phoenix.Endpoint.server_info/2`.

# `server_pid`

```elixir
@spec server_pid(module(), :http | :https) ::
  {:ok, pid()} | {:error, :no_server_found}
```

The MuroPlug (Thousand Island) process serving `scheme` for `endpoint`.

---

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