{"repo":"andywer/pg-listen","free":true,"listed":false,"github":"https://github.com/andywer/pg-listen","clone":"git clone https://github.com/andywer/pg-listen.git","description":"📡 PostgreSQL LISTEN & NOTIFY for node.js that finally works.","language":"TypeScript","stars":635,"topics":["postgresql","nodejs","typescript","pubsub","notifications","message-passing","events"],"license":"MIT","category":"databases-storage","readme_excerpt":"pg-listen Postgres LISTEN & NOTIFY that works PostgreSQL can act as a message broker: Send notifications with arbitrary payloads from one database client to others. Works with node.js 8+ and plain JavaScript or TypeScript 3. Uses the Postgres NOTIFY statement and subscribes to notifications using LISTEN . Features &nbsp;&nbsp;&nbsp;&nbsp;📡&nbsp;&nbsp;Send and subscribe to messages &nbsp;&nbsp;&nbsp;&nbsp;⏳&nbsp;&nbsp;Continuous connection health checks &nbsp;&nbsp;&nbsp;&nbsp;♻️&nbsp;&nbsp;Reconnects automatically &nbsp;&nbsp;&nbsp;&nbsp;❗️&nbsp;&nbsp;Proper error handling &nbsp;&nbsp;&nbsp;&nbsp;👌&nbsp;&nbsp;Type-safe API --- Installation Usage API For details see dist/index.d.ts. Error & event handling instance.events.on(\"connected\", listener: () = void) The connected event is emitted once after initially establishing the connection and later once after every successful reconnect. Reconnects happen automatically when pg-listen detects that the connection closed or became unresponsive. instance.events.on(\"error\", listener: (error: Error) = void) An error event is emitted for fatal errors that affect the notification subscription. A standard way of handling those kinds of errors would be to console.error() -log the error and terminate the process with a non-zero exit code. This error event is usually emitted after multiple attempts to reconnect have failed. instance.events.on(\"notification\", listener: ({ channel, payload }) = void) Emitted whenever a notification is receive","default_branch":null,"files":null,"tree":[],"storefront":"/r/andywer","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/andywer/pg-listen/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}