@abtnode/event-hub
v1.5.5
Published
A nodejs module for local and remote Inter Process Event
Downloads
55
Readme
ABT Node Event Hub
A module for local and remote Inter Process Event
Usage
Install
yarn add @abtnode/event-hub
Server
process.env.ABT_NODE_EVENT_PORT=8888;
require('@abtnode/event-hub/lib/server.js);
Client
// process 1
process.env.ABT_NODE_EVENT_PORT = 8888;
const client = require('@abtnode/event-hub');
const data = { foo: bar };
client.broadcast('my-event', data);
// process 2
process.env.ABT_NODE_EVENT_PORT = 8888;
const client = require('@abtnode/event-hub');
client.on('my-event', (data) => {
// handle data
});