{"_id":"pg-ipc","_rev":"5-add94c727d4f7a08494eb84f7c3953f0","name":"pg-ipc","description":"IPC over PostgreSQL LISTEN/NOTIFY/UNLISTEN exposed as an EventEmitter","dist-tags":{"latest":"1.0.5"},"versions":{"1.0.3":{"name":"pg-ipc","version":"1.0.3","description":"IPC over PostgreSQL LISTEN/NOTIFY/UNLISTEN exposed as an EventEmitter","main":"index.js","dependencies":{},"devDependencies":{"after-all":"^2.0.2","pg":"^6.1.2","speedometer":"^1.0.0","statistics":"^3.3.0","tape":"^4.6.2"},"scripts":{"test":"tape test.js"},"repository":{"type":"git","url":"git+https://github.com/emilbayes/pg-ipc.git"},"keywords":["ipc","pg","postgres","eventemitter","notify","async"],"author":{"name":"Emil Bay","email":"github@tixz.dk"},"license":"ISC","bugs":{"url":"https://github.com/emilbayes/pg-ipc/issues"},"homepage":"https://github.com/emilbayes/pg-ipc#readme","gitHead":"91ee7fd3e938edcda50376e156fc674975a04343","_id":"pg-ipc@1.0.3","_shasum":"44326082704b0ea01afd686d968a27ca259a19be","_from":".","_npmVersion":"4.1.2","_nodeVersion":"7.5.0","_npmUser":{"name":"emilbayes","email":"github@tixz.dk"},"dist":{"shasum":"44326082704b0ea01afd686d968a27ca259a19be","tarball":"https://registry.npmjs.org/pg-ipc/-/pg-ipc-1.0.3.tgz","integrity":"sha512-bL30pN1yElDtY0mSkHr3UKqOVYC6LhQ4+hxqZj1ECx1UB47L8Pa8o7dFjalbENxNQ58wNOxB/y4fkt6KX1lOQg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCYh8OjTPLlTzLTvoKlHVDHv23N0BfZtisCyMnMiP2SjAIgdq4zc6MVP/wuooovGKYcozw4px2+Z8pu8j4zFH/DG0E="}]},"maintainers":[{"name":"emilbayes","email":"github@tixz.dk"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/pg-ipc-1.0.3.tgz_1485940184122_0.3169730219524354"},"directories":{}},"1.0.4":{"name":"pg-ipc","version":"1.0.4","description":"IPC over PostgreSQL LISTEN/NOTIFY/UNLISTEN exposed as an EventEmitter","main":"index.js","dependencies":{},"devDependencies":{"after-all":"^2.0.2","pg":"^6.1.2","speedometer":"^1.0.0","statistics":"^3.3.0","tape":"^4.6.2"},"scripts":{"test":"tape test.js"},"repository":{"type":"git","url":"git+https://github.com/emilbayes/pg-ipc.git"},"keywords":["ipc","pg","postgres","eventemitter","notify","async"],"author":{"name":"Emil Bay","email":"github@tixz.dk"},"license":"ISC","bugs":{"url":"https://github.com/emilbayes/pg-ipc/issues"},"homepage":"https://github.com/emilbayes/pg-ipc#readme","gitHead":"6884a2925d3f38ad443f5829ba9d625b79fd4323","_id":"pg-ipc@1.0.4","_shasum":"e018f5aae417ded8a917878e33c1fe911bcce45f","_from":".","_npmVersion":"4.1.2","_nodeVersion":"7.5.0","_npmUser":{"name":"emilbayes","email":"github@tixz.dk"},"dist":{"shasum":"e018f5aae417ded8a917878e33c1fe911bcce45f","tarball":"https://registry.npmjs.org/pg-ipc/-/pg-ipc-1.0.4.tgz","integrity":"sha512-d5DlnduVWAt/7e0XIxPWrZMucAllTaHzGzbpg1PtBNb6jePVNYpkzbKumQCkbHst/MghgtX7mtVGUiFJBVrM3A==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIBygu2GqQDZ4+il1yEAHvwnW2pzy/yeTKZlYqZZ3mQqGAiEAqr0DRqmPMnznAfQi6x1f/9nEEjduBXVJ99hpl27FQmU="}]},"maintainers":[{"name":"emilbayes","email":"github@tixz.dk"}],"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/pg-ipc-1.0.4.tgz_1485940598023_0.2815293329767883"},"directories":{}},"1.0.5":{"name":"pg-ipc","version":"1.0.5","description":"IPC over PostgreSQL LISTEN/NOTIFY/UNLISTEN exposed as an EventEmitter","main":"index.js","dependencies":{},"devDependencies":{"after-all":"^2.0.2","pg":"^6.1.2","speedometer":"^1.0.0","statistics":"^3.3.0","tape":"^4.6.2"},"scripts":{"test":"tape test.js"},"repository":{"type":"git","url":"git+https://github.com/emilbayes/pg-ipc.git"},"keywords":["ipc","pg","postgres","eventemitter","notify","async"],"author":{"name":"Emil Bay","email":"github@tixz.dk"},"license":"ISC","bugs":{"url":"https://github.com/emilbayes/pg-ipc/issues"},"homepage":"https://github.com/emilbayes/pg-ipc#readme","gitHead":"213bed095cc7677d3bc4de8bd00dfe54e826801f","_id":"pg-ipc@1.0.5","_nodeVersion":"15.8.0","_npmVersion":"6.14.11","dist":{"integrity":"sha512-nF4uB5vuqvPCeyWGLRVCOLxGaXq8tVMVZ+rCkX0XGbErlUUCwpb6+uME6s6vkB2T3n8lhZwojn5frFl67I5Ugg==","shasum":"9aad40e51a123c41b635f97748372578ddf8de94","tarball":"https://registry.npmjs.org/pg-ipc/-/pg-ipc-1.0.5.tgz","fileCount":6,"unpackedSize":10155,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgInTPCRA9TVsSAnZWagAAYWUP/2dUMNxoPbZUvgR3rZWy\nRB4Rv6WckDUxEZuvfm9KX1xb6/gFsjmgN65yeAvPAOQAVCy+bJ617iu/ILlI\nkytPUEjd7HS98oUgiphUVKjn5KDjoGwhO2YoCldaMRWDh5L9eXTXj0GnCpSr\nKUIEOl0Q+iEboyz+/4tvBS7OjCIQVfaGYnxj4SRMdyTf9gEzcD2+sY7i7yAq\nXDH8fwp5QLIb4qZoj4+W5gawD5VOWCYGcUa4wwTmCU60rUQ7n+V+emoTyiEb\nNiTFLMYD/JW+/NghLOESldfY7EWuleb0eInTel5/waXossjbCIqGugRBlxVo\nZsdFa+wtnKRFiVWyKGg+EmOOSOuUSLLU7Dwj2Yv0HiZlZbj91TXqTqvwOqNp\ntg83YAuh82kerdsfSK4+420IEGliS5Kh4VsQSt7aRJmvjHVSOACOBO1Nv2vS\npSTkqLfJqVWb8pvXnrIgGY7whMq2t47TX4iklfvCLSL+zeSc5waZ++wrVBNm\nDpqnMk4eGsdV5wonW+IA0VS3wnC7OXT17mNCPrI5kHDJw2WLOcrbOXYrn0e9\np7cgtep7SZiohUuj3kF4Oym1Ilkdbv7Iz9S6y8+bGvG7fEGTgpczz8QdESg/\nzSreUfH+UM+mafJt/xEs7ChlzAdebv3/+CURFU+BzGQFXO7clwCB7Men6ZDn\nslWQ\r\n=jkCu\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCD4cYNPtKKCkzJxxxlIZe+n4MRRCbBubYSZmbXSjNdLwIhAPUMFsv4+LD+8nMZxfjRVZPRf9eWUXoZxAGi3XLFVWqo"}]},"_npmUser":{"name":"emilbayes","email":"github@tixz.dk"},"directories":{},"maintainers":[{"name":"emilbayes","email":"github@tixz.dk"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/pg-ipc_1.0.5_1612870863391_0.4490258713865054"},"_hasShrinkwrap":false}},"readme":"# `pg-ipc`\n\n> IPC over PostgreSQL LISTEN/NOTIFY/UNLISTEN exposed as an EventEmitter\n\n## Usage\n\n```js\nvar pgIPC = require('pg-ipc')\nvar client = new require('pg').Client({ ... })\n\nvar ipc = pgIPC(client)\n\nipc.on('error', console.error)\n\nipc.on('end', function () {\n  client.end()\n})\n\nipc.on('someChannel', function (msg) {\n  // Ignore messages from this process\n  if (msg.processId === client.processID) return\n  console.log(msg.payload.currentTime)\n})\n\nipc.notify('someChannel', {currentTime: Date.now()})\n\n// some time later ...\n\nipc.end()\n\n```\n\n## API\n\n### `pgIPC(client)`\n\nInstantiates a new `EventEmitter` with the appropriate hooks to automatically\n`LISTEN`/`NOTIFY`/`UNLISTEN`. Note that `client` must be a `pg.Client` instance\nand not a `pg.Pool`, as a single connection is required.\n\n### `ipc.on(channel, listener)`\nAll the standard `EventEmitter` methods are exposed. When a listener is added to\n`channel`, a `LISTEN` command is automatically issued, and `UNLISTEN` when the\nnumber of listeners reach zero. The listener will receive the message as its\nfirst argument. Notable properties being `channel`, `payload`, `processId`. Each\npostgres `connection` is assigned a unique `processId`, which can be used to\nignore messages from the same process.\nSee [`EventEmitter`](https://nodejs.org/api/events.html) for more details.\nReserved channels are:\n`['newListener', 'removeListener', 'notify', 'unlisten', 'listen', 'error', 'end']`\n\n### `ipc.notify(channel[, payload])`\nAlias: `ipc.send(channel[, payload])`. Send a message to `channel` with optional\n`payload`. `payload` is transparently converted to JSON where appropriate.\n\n### `ipc.end()`\nIssue `UNLISTEN *` if connected, emit `end` and detach all event listeners.\nDoes not call `client.end()` so you can continue using the client. However,\nany listeners you've issued outside outside of this module will also be detached\n\n### Event: `listen`\n\nEmitted when a `LISTEN` has been successfully issued. Passed `channel`\n\n### Event: `notify`\n\nEmitted after a notification has been successfully sent. Passed `channel` and `payload`\n\n### Event: `unlisten`\n\nEmitted when a `UNLISTEN` has been successfully issued. Passed `channel`\n\n### Event: `end`\n\nEmitted when all `LISTEN`s have been removed, but before all event listeners are removed.\n\n### Event: `error`\n\nPropagates any errors caused by queries on `Client`. Passed the `err` argument from\nthe query callback.\n\n## Install\n\n```sh\nnpm install pg-ipc\n```\n\n## License\n\n[ISC](LICENSE.md)\n","maintainers":[{"name":"emilbayes","email":"github@tixz.dk"}],"time":{"modified":"2022-06-23T19:42:13.361Z","created":"2017-02-01T09:09:45.849Z","1.0.3":"2017-02-01T09:09:45.849Z","1.0.4":"2017-02-01T09:16:38.605Z","1.0.5":"2021-02-09T11:41:03.536Z"},"homepage":"https://github.com/emilbayes/pg-ipc#readme","keywords":["ipc","pg","postgres","eventemitter","notify","async"],"repository":{"type":"git","url":"git+https://github.com/emilbayes/pg-ipc.git"},"author":{"name":"Emil Bay","email":"github@tixz.dk"},"bugs":{"url":"https://github.com/emilbayes/pg-ipc/issues"},"license":"ISC","readmeFilename":"README.md"}