ExRatatui.Distributed.Listener (ExRatatui v0.7.1)

Copy Markdown View Source

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}
]

Summary

Functions

Returns a specification to start this module under a supervisor.

Returns the DynamicSupervisor pid used for per-attach sessions.

Starts the Listener supervisor.

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

session_sup(listener \\ __MODULE__)

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

Returns the DynamicSupervisor pid used for per-attach sessions.

start_link(opts)

@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).