Event Hub
A module for local and remote Inter Process Event
Usage
Install
yarn add @arcblock/event-hub
Server
process.env.ABT_NODE_EVENT_PORT=8888;
require('@arcblock/event-hub/lib/server.js);
Client
const Client = require('@arcblock/event-hub/lib/client');
const port = '';
const did = '';
const sk = '';
const client = new Client({ port, did, sk, autoConnect: true });
const data = { foo: bar };
client.broadcast('my-event', data);
const Client = require('@arcblock/event-hub/lib/client');
const port = '';
const did = '';
const sk = '';
const client = new Client({ port, did, sk, autoConnect: true });
client.on('my-event', (data) => {
});