Constructor for initializing the listener from a configuration object.
Configuration object for initializing the instance.
Configuration object for initializing the instance.
Readonly
connectionsA list of all live connections, created by method listen.
Connections that are no longer live are automatically removed from the list.
This is mainly for the logging purpose / diagnostics.
Beware of calling IListenResult.cancel while iterating over it, because IListenResult.cancel removes the connection from this list. In most cases, cancelAll is a better choice.
Calls IListenResult.cancel for each result item inside connections, and returns the number of successful cancellations.
Parameter for each IListenResult.cancel call.
Initiates listening to specified channels for notifications, while automatically handling reconnection on lost connections.
It allocates and fully occupies one physical connection from the pool, allowing for the flexibility of choosing how to split channels across connections.
Once connected initially, the result is automatically registered within connections.
If you want a connection just for sending notifications, pass in an empty list of channels.
An array of channel names to listen to. It can be empty if you want a connection just for sending notifications.
Optional
e: IListenEventsOptional event handlers for managing notifications, connection events, and errors.
A promise that resolves to an object with post-connect API.
Provides functionality to listen to Postgres
NOTIFY / LISTEN
events and handle them dynamically using provided configuration and event handlers.