Need private packages and team management tools?Check out npm Teams »

emitter-pubsub-broker

1.0.1 • Public • Published

emitter-pubsub-broker

NPM Version Build Status Appveyor status Coverage Status Dependency Status JavaScript Style Guide

An utility for connecting EventEmitters via a pubsub. Includes Redis and in-memory backends, and a support of other systems can be added by implementing a very simple Connector wrapper.

Table of Contents

Installation

$ npm i emitter-pubsub-broker

Usage

const EmitterPubsubBroker = require('emitter-pubsub-broker')
const connect = 'redis://localhost:6379' // or empty for in-memory backend
 
let broker = new EmitterPubsubBroker(connect)
let client = new EventEmitter() // anything that implements the interface
 
client.on('myEvent', (...args) => { /* handler code */ })
 
broker.subscribe(client, 'my-channel')
  .then(() => broker.publish('my-channel', 'myEvent', ...args))

API

API documentation is available online.

Contribute

If you encounter a bug in this package, please submit a bug report to github repo issues.

PRs are also accepted.

License

MIT

Install

npm i emitter-pubsub-broker

DownloadsWeekly Downloads

1

Version

1.0.1

License

MIT

Unpacked Size

25 kB

Total Files

12

Last publish

Collaborators

  • avatar