GenServer that listens for PostgreSQL NOTIFY events for live table updates.
This process uses Postgrex to establish a separate connection to PostgreSQL
and listens for notifications on the phoenix_kit_db_changes channel.
When a notification is received, it broadcasts via PubSub so LiveViews can update in real-time.
Usage
Since PhoenixKit is a library, the Listener is started lazily on first use.
Call ensure_started/0 before subscribing, or use the subscribe functions
which will ensure it's started automatically.
Summary
Functions
Returns a specification to start this module under a supervisor.
Ensures the Listener is started. Called automatically by subscribe functions.
Starts the listener process.
Subscribe to changes for a specific table.
Subscribe to all table changes (for the index page).
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.
Ensures the Listener is started. Called automatically by subscribe functions.
The Listener is normally started by PhoenixKit.Supervisor. This function is a safety check that logs a warning if the Listener isn't running.
Returns :ok if running, or :ok with a warning log if not (subscriptions
will still work but won't receive notifications until the Listener starts).
Starts the listener process.
Subscribe to changes for a specific table.
Subscribe to all table changes (for the index page).
Unsubscribe from changes for a specific table.
Unsubscribe from all table changes.