Resilient Postgres LISTEN/NOTIFY client with automatic reconnection. Current stable version: 1.2.3. Low release cadence (no recent updates). The author recommends using pg-listen instead. Handles connection drops, but has known issue of accumulating LISTEN statements on reconnect. Differentiator: built-in reconnect with configurable check interval and max attempts.
npm install pg-earsNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Connect to Postgres, listen on a channel, and notify with JSON payload.
Switch to pg-listen (https://github.com/andywer/pg-listen)
Manually manage reconnection or switch to pg-listen
Ensure channel names are safe PostgreSQL identifiers; do not use user input directly
Use require() instead of import
Always use (err, data) => {...} signatureInvoke the exported function: const pgEars = require('pg-ears')(options)Avoid using pg-ears; use pg-listen instead
npm install pg pg-ears