# `ExRatatui.Distributed.Listener`
[🔗](https://github.com/mcass19/ex_ratatui/blob/v0.7.1/lib/ex_ratatui/distributed/listener.ex#L1)

Supervisor for distribution-attach sessions on the app node.

When an `ExRatatui.App` is started with `transport: :distributed`,
`dispatch_start/1` starts this supervisor instead of the usual
Server process. The Listener sits idle until a remote node calls
`ExRatatui.Distributed.attach/2`, which triggers `start_session/4`
to spawn a Server in `:distributed_server` mode under the
Listener's `DynamicSupervisor`.

## Usage

Typically you don't start this directly; `use ExRatatui.App` routes
`start_link(transport: :distributed, ...)` through here:

    children = [
      {MyApp.TUI, transport: :distributed}
    ]

For full control you can add it to a supervision tree by hand:

    children = [
      {ExRatatui.Distributed.Listener, mod: MyApp.TUI}
    ]

# `child_spec`

Returns a specification to start this module under a supervisor.

See `Supervisor`.

# `session_sup`

```elixir
@spec session_sup(Supervisor.supervisor()) :: pid()
```

Returns the DynamicSupervisor pid used for per-attach sessions.

# `start_link`

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

Starts the Listener supervisor.

## Options

  * `:mod` (required) — the `ExRatatui.App` module to serve.
  * `:name` — process registration name (default: `__MODULE__`).
    Pass `nil` to skip registration.
  * `:app_opts` — extra opts merged into every client's `mount/1`
    callback (e.g. shared PubSub topic names).

---

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