pm2-intercom-improvement

1.0.4 • Public • Published

Simple IPC for PM2

Simple inter process communication for processes managed by PM2. Require PM2 > 16.0.0.

$ pm2 install pm2-intercom-improvement

Emit a message

To emit a message just use the builtin process.send function of Node.js. pm2-intercom will then receive the message and will broadcast it to all processes.

process.send({
  topic : 'cmd:topic',
  data  : {
    some : 'data'
  }
});

Receive message

process.on('message', function(packet) {
  if (packet.topic == 'cmd:topic') {
    console.log('Received packet', packet.data);
  }
});

License

MIT

Package Sidebar

Install

npm i pm2-intercom-improvement

Weekly Downloads

217

Version

1.0.4

License

MIT

Unpacked Size

9.33 kB

Total Files

11

Last publish

Collaborators

  • zeong