pgredis-bun-listen
v0.1.0
Published
Bun-native PostgreSQL LISTEN/NOTIFY client for pgredis and standalone realtime use cases
Readme
pgredis-bun-listen
Bun-native PostgreSQL LISTEN/NOTIFY client used by pgredis. It is published
as a separate package so Bun projects can use it directly without installing
the full pgredis toolkit.
It connects through Bun.connect() and implements the PostgreSQL wire protocol
for notification workloads. It supports TLS negotiation, MD5, cleartext, and
SCRAM-SHA-256 authentication.
Install
bun add pgredis-bun-listenUsage
import { createPgListener } from "pgredis-bun-listen";
const listener = createPgListener(process.env.DATABASE_URL!, {
channels: ["events"],
onNotify(channel, payload) {
console.log(channel, payload);
}
});
await listener.notify("events", JSON.stringify({ type: "ready" }));
listener.close();