process comunications via child process in nodejs
process.on('message', (m) => {
console.log('CHILD got message:', m);
});
process.send({ foo: 'bar' });
const child = require('child_process').fork('child.js');
child.on('message', (m) => {
console.log('PARENT got message:', m);
});
child.send({ hello: 'world' });