msghub

A simple communication layer for inter-process communcation between mulitple worker processes

msghub

A simple communication layer for inter-process communcation between mulitple worker processes in a clustered environment.

This module works best in combination with the various-cluster module

$ npm install msghub

require it in your code, and use it:

var msghub = require('msghub');
msghub.on('my-custom-event', function (msg) {
  console.log(msg); // will print 'wow, thats cool!' to the console 
});
msghub.send('my-custom-event', 'wow, thats cool!');

see the examples-directory!

api-docs: (open doc/index.html in your browser)

require('msghub');
var msghub = require('msghub');
msghub.on('my-event-listener', function (msg) {
  // do something with message 
});
msghub.send('my-event-listener', 'just a simple message');
msghub.random('my-event-listener', 'just a simple message');
msghub.roundrobin('my-event-listener', 'just a simple message');

In lieu of a formal styleguide, take care to maintain the existing coding style. Lint your code using Grunt

  • 0.1.3 wait 2 seconds with sending, when no listener is attached

  • 0.1.2 send msg as array if more than 1 param is given

  • 0.1.1 add hint to various-cluster to readme

  • 0.1.0 Initial Release

  • Bastian "hereandnow" Behrens

Copyright (c) 2013 Valiton GmbH Licensed under the MIT license.