pgListenNotify
function pgListenNotify(client, channel?): WatchSubscribe;Defined in: src/storage/watch.ts:115
A WatchSubscribe backed by Postgres LISTEN/NOTIFY. Pair it with withWatch for
the postgres or drizzle-over-pg drivers. Your migration owns the trigger that pg_notifys
channel with the changed key as payload; this only LISTENs.
The channel is a parameter: products pass the channel they document ("xtandard_webhooks", …).
The neutral default is "xtandard_kv".
Parameters
Section titled “Parameters”| Parameter | Type | Default value |
|---|---|---|
client |
PgNotificationClient |
undefined |
channel? |
string |
"xtandard_kv" |
Returns
Section titled “Returns”Example
Section titled “Example”import { Client } from "pg";const listener = new Client({ connectionString: process.env.DATABASE_URL });await listener.connect();const storage = withWatch(base, pgListenNotify(listener, "xtandard_webhooks"));