NotificationManager
Manages asynchronous notifications (LISTEN / NOTIFY) for a specific database session.
This manager provides methods to subscribe to and unsubscribe from PostgreSQL notification channels, emit new notifications, and start listener loops to receive incoming messages via a Flow.
Properties
Functions
Link copied to clipboard
Drops whatever this session subscribed to, if anything.
Link copied to clipboard
Starts a listener loop that blocks indefinitely. When the coroutine is cancelled, it simply closes the socket.
Link copied to clipboard
suspend fun startPollingListenerLoop(pollTimeoutMs: Int = 500, dispatcher: CoroutineDispatcher? = null)
Starts a listener loop using active polling with a socket timeout. When the coroutine is cancelled, the loop exits gracefully without closing the underlying database connection, allowing it to be reused.
Link copied to clipboard
Stops listening for all notifications on this connection.