1.6.1 • Published 4 years ago

@fabrix/spool-pgpubsub v1.6.1

Weekly downloads
2
License
MIT
Repository
github
Last release
4 years ago

spool-pgpubsub

Gitter NPM version Build Status Test Coverage Dependency Status Follow @FabrixApp on Twitter

Conventional Commits

:package: PgPubsub Spool PG Listen

Utilizes PG Listen to add a Fabrix Extension

Install

$ npm install --save @fabrix/spool-pgpubsub

Configure

// config/main.ts
import { PgPubsubSpool } from '@fabrix/spool-pgpubsub'
export const main = {
  spools: [
    // ... other spools
    PgPubsubSpool
  ]
}

Configuration

// config/pgpubsub.ts
export const pgpubsub = {

}

Usage

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)
1.6.1

4 years ago

1.6.0

4 years ago