@jumpfoxltd/broker

1.1.3 • Public • Published

@jumpfox/broker

Build

Message Broker for javascript applications

request or import Broker in your code and call

  • subscribe to create a subscription to a topic with a callback to handle the incoming messages
  • publish to publish a message to other listeners
  • unsubscribe to stop listening to a topic

Usage

import {Broker} from '@jumpfoxltd/broker';

or

const {Broker} = require('@jumpfoxltd/broker');

Subscribe

const topic = 'test-topic';
cost cb = (payload)=>{ 
// the payload can be anything that you want to consume
}
Broker.subscribe(topic,cb);

Publish

In order publish a topic , you have to subscribe a topic first and then you can publish anything you want to it

const topic = 'test-topic';
Broker.publish(topic,{data:'test'});

Unsubscribe

const topic = 'test-topic';
cost cb = (payload)=>{ 
// the payload can be anything that you want to consume
}
Broker.unsubscribe(topic,cb);

Package Sidebar

Install

npm i @jumpfoxltd/broker

Weekly Downloads

0

Version

1.1.3

License

Apache-2.0

Unpacked Size

21.8 kB

Total Files

10

Last publish

Collaborators

  • fokion