Skip to content

Instance Method

listen(on:consume:)

Listen to a channel and run closure with PostgresNotificationSequence.
func listen<Value>(on channel: String, consume: nonisolated(nonsending) (PostgresNotificationSequence) async throws -> Value) async throws -> Value

Parameters

channel

The channel to listen on.

consume

Closure that is called with a PostgresNotificationSequence.

Discussion

When the closure is exited the UNLISTEN command is automatically sent for the provided channel.