https://github.com/fabrix-app/spool-pgpubsub
Spool: PgPubsub
https://github.com/fabrix-app/spool-pgpubsub
Last synced: over 1 year ago
JSON representation
Spool: PgPubsub
- Host: GitHub
- URL: https://github.com/fabrix-app/spool-pgpubsub
- Owner: fabrix-app
- License: mit
- Created: 2019-11-11T15:33:48.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2023-01-24T00:45:18.000Z (over 3 years ago)
- Last Synced: 2025-01-26T09:32:34.499Z (over 1 year ago)
- Language: TypeScript
- Size: 873 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 16
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: .github/CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# spool-pgpubsub
[![Gitter][gitter-image]][gitter-url]
[![NPM version][npm-image]][npm-url]
[![Build Status][ci-image]][ci-url]
[![Test Coverage][coverage-image]][coverage-url]
[![Dependency Status][daviddm-image]][daviddm-url]
[![Follow @FabrixApp on Twitter][twitter-image]][twitter-url]
[](https://conventionalcommits.org)
:package: PgPubsub Spool [PG Listen](https://github.com/andywer/pg-listen)
Utilizes [PG Listen](https://github.com/andywer/pg-listen) to add a Fabrix Extension
## Install
```sh
$ npm install --save @fabrix/spool-pgpubsub
```
## Configure
```js
// config/main.ts
import { PgPubsubSpool } from '@fabrix/spool-pgpubsub'
export const main = {
spools: [
// ... other spools
PgPubsubSpool
]
}
```
## Configuration
```
// config/pgpubsub.ts
export const pgpubsub = {
}
```
## Usage
```js
const sayHello = (payload) => {
// Do something with Payload when an event is published to channel
console.log(payload)
}
// Add a Channel
this.app.spools.pgpubsub.subscribe(name, sayHello)
// Publish to the Channel
this.app.spools.pgpubsub.publish(name, data)
// Completely rid the channel
this.app.spools.pgpubsub.unsubscribe(name, sayHello)
```
[npm-image]: https://img.shields.io/npm/v/@fabrix/spool-pgpubsub.svg?style=flat-square
[npm-url]: https://npmjs.org/package/@fabrix/spool-pgpubsub
[ci-image]: https://img.shields.io/circleci/project/github/fabrix-app/spool-pgpubsub/master.svg
[ci-url]: https://circleci.com/gh/fabrix-app/spool-pgpubsub/tree/master
[daviddm-image]: http://img.shields.io/david/fabrix-app/spool-pgpubsub.svg?style=flat-square
[daviddm-url]: https://david-dm.org/fabrix-app/spool-pgpubsub
[gitter-image]: http://img.shields.io/badge/+%20GITTER-JOIN%20CHAT%20%E2%86%92-1DCE73.svg?style=flat-square
[gitter-url]: https://gitter.im/fabrix-app/fabrix
[twitter-image]: https://img.shields.io/twitter/follow/FabrixApp.svg?style=social
[twitter-url]: https://twitter.com/FabrixApp
[coverage-image]: https://img.shields.io/codeclimate/coverage/github/fabrix-app/spool-pgpubsub.svg?style=flat-square
[coverage-url]: https://codeclimate.com/github/fabrix-app/spool-pgpubsub/coverage