GenServer that listens for PostgreSQL NOTIFY events for live table
updates.
Holds a separate Postgrex.Notifications connection (auto-reconnect
on drop) on the phoenix_kit_db_changes channel. When a notification
arrives it broadcasts via PhoenixKitDb.PubSub so LiveViews can
react in real time.
Started via the PhoenixKit.Module.children/0 callback on
PhoenixKitDb, which the host's PhoenixKit.Supervisor consumes
when the module is enabled.
Summary
Functions
Returns a specification to start this module under a supervisor.
Ensures the Listener is started. Called automatically by the
subscribe helpers. The Listener is normally started by
PhoenixKit.Supervisor via this module's children/0 callback;
this function logs a warning if it isn't running so a missed startup
is observable rather than silent.
Starts the listener process.
Subscribe to changes for a specific table.
Subscribe to all table changes (Index + Activity pages).
Unsubscribe from changes for a specific table.
Unsubscribe from all table changes.
Functions
Returns a specification to start this module under a supervisor.
See Supervisor.
@spec ensure_started() :: :ok
Ensures the Listener is started. Called automatically by the
subscribe helpers. The Listener is normally started by
PhoenixKit.Supervisor via this module's children/0 callback;
this function logs a warning if it isn't running so a missed startup
is observable rather than silent.
@spec start_link(keyword()) :: GenServer.on_start()
Starts the listener process.
Subscribe to changes for a specific table.
@spec subscribe_all() :: :ok | {:error, term()}
Subscribe to all table changes (Index + Activity pages).
Unsubscribe from changes for a specific table.
@spec unsubscribe_all() :: :ok | {:error, term()}
Unsubscribe from all table changes.