An Effect SQL client for PGlite, a WASM build of PostgreSQL that runs in the browser, Node.js, and Bun.
npm install effect@rc @effect/sql-pglite@rclisten is a scoped subscription that returns after the listener is installed.
It exposes notifications through a queue and keeps the subscription active for
the surrounding scope:
import { PgliteClient } from "@effect/sql-pglite"
import { Effect, Queue } from "effect"
const program = Effect.gen(function*() {
const sql = yield* PgliteClient.PgliteClient
const notifications = yield* sql.listen("events")
yield* sql.notify("events", "ready")
return yield* Queue.take(notifications)
})