ipeb
v1.0.2
Published
The IPEB or Intermediate Process Event Buss is an npm package that aims to trivialize inter-process communications between NODE processes.
Downloads
4
Readme
intermediate-process-event-buss
The IPEB or Intermediate Process Event Buss is an npm package that aims to trivialize inter-process communications between NODE processes.
// index.js
const { ProcessHub } = require('ipeb');
const path = require('path');
const hub = new ProcessHub(process);
processHub.spawn(path.join(__dirname, 'intervalDemo.js'));
processHub.spawn(path.join(__dirname, 'messageDemo1.js'));
processHub.spawn(path.join(__dirname, 'messageDemo2.js'));
// intervalDemo
const { ProcessClient } = require('ipeb');
const processClient = new ProcessClient('interval demo');
let i = 0;
setInterval(() => console.log(i++), 1000);
// messageDemo1.js
const { ProcessClient } = require('ipdb');
const client = new ProcessClient('message demo 1');
let i = 0;
setInterval(() => client.emit('ping', {
counter: i++,
}), 3000);
// messageDemo2.js
const { ProcessClient } = require('ipeb');
const processClient = new ProcessClient('message demo 2');
processClient.on('ping', (message) => {
console.log(message.counter);
});