Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

msghub

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

msghub

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

  • 0.1.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

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

Getting Started

$ 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!');

Examples

see the examples-directory!

Documentation

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

Steps:

you need to require it in your master!
require('msghub');
and in all workers you want:
var msghub = require('msghub');
append Event-Listeners and name them whatever you want:
msghub.on('my-event-listener', function (msg) {
  // do something with message
});
now you can send from anywhere inside your application to all workers which are binded to that event:
msghub.send('my-event-listener', 'just a simple message');
or send a message to some random listener inside your application:
msghub.random('my-event-listener', 'just a simple message');
or send a message in roundrobin manner to one listener inside your application:
msghub.roundrobin('my-event-listener', 'just a simple message');

Contributing

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

Release History

  • 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

Contributors

  • Bastian "hereandnow" Behrens

License

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

Keywords

FAQs

Package last updated on 21 May 2013

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc