Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

pg-pubsub

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pg-pubsub - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

CHANGELOG.md

2

index.js

@@ -122,3 +122,3 @@ /*jslint node: true */

this.retry.end();
this.removeAllListeners(channel);
this.removeAllListeners();
this.channels = [];

@@ -125,0 +125,0 @@ };

{
"name": "pg-pubsub",
"version": "0.1.0",
"version": "0.1.1",
"description": "A Publish/Subscribe implementation on top of PostgreSQL NOTIFY/LISTEN",
"url": "http://github.com/voxpelli/node-pg-pubsub",
"homepage": "http://github.com/voxpelli/node-pg-pubsub",
"repository": {

@@ -17,4 +17,4 @@ "type": "git",

"dependencies": {
"lodash": "^2.4.1",
"promise": "^5.0.0",
"lodash": "^3.0.0",
"promise": "^6.0.0",
"promised-retry": "^0.1.0"

@@ -21,0 +21,0 @@ },

@@ -11,2 +11,6 @@ # PG PubSub

## Requirements
Either the `pg` or the `pg.js` npm package has to be installed.
## Usage

@@ -22,6 +26,9 @@

});
```
Advanced:
Sending `NOTIFY channelName, '{"hello":"world"}'` to PostgreSQL will trigger the above listener with the parsed JSON in `channelPayload` .
More advanced variant:
```javascript

@@ -42,7 +49,11 @@ var pubsubInstance = new PGPubsub('postgres://username@localhost/tablename');

* **removeChannel(channelName[, eventListener])** – either removes all event listeners and stops listeneing on the channel or removes the specified event listener and stops listening on the channel if that was the last listener attached.
* **close** – closes down the database connection and removes all listeners
* **close** – closes down the database connection and removes all listeners. Useful for graceful shutdowns.
* All [EventEmitter methods](http://nodejs.org/api/events.html#events_class_events_eventemitter) are inherited from `EventEmitter`
## Description
Creating a `PGPubsub` instance will not do much up front. It will prepare itself to start a Postgres connection once the first channel is added and then it will keep a connection open until its shut down, reconnecting it if it gets lost, so that it can constantly listen for new notifications.
## Lint / Test
`npm test` or to watch, install `grunt-cli` then do `grunt watch`
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc