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

centaur

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

centaur

Distributed messaging framework

  • 0.0.0
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
4
increased by300%
Maintainers
1
Weekly downloads
 
Created
Source

Gossip

Simple distributed messaging built with ZeroMQ.

Build Status

Install

npm install gossip

Note:

Make sure you have you have ZeroMQ v3.2.3+ installed.

If you are using OS X you can use brew to install ZeroMQ:

brew install zeromq

For Windows / UNIX check the instructions here..

Quick Start

Suppose you wanted to monitor the temperature of a bunch of remote gauges so things don't blow up.

A typical setup for this would be to run a monitor Node and a gauge Node.

This would look like:


//
// Gauges server
//

var gossip = require('gossip');

// Nodes are the building block of gossip. You should run one node per process.
// They can send and receive messages to / from a cluster of nodes.
var node = new gossip.Node('ipc://temp-gauges');

// You can subscribe to messages you are interested in.
// Any node can check your temperature by sending you a `check-temp` message. Yay!
node.on('check-temp', function (message, reply) {
  var gauge = gauges[message.data.gauge];

  // read the temperature
  var temp = gauge.readTemp();

  // send a response back
  var response = {
    temp: temp,
    time: Date.now()
  };

  node.reply(message, response);
});


//
// Monitor server
//

var gossip = require('gossip');

var node = new gossip.Node('ipc://temp-monitor');

// Join the monitor to the gauges. This will allows the node to send messages to any nodes that are known
// by the node you are connecting to.
node.join('ipc://temp-gauges');

setInterval(function () {
  // check temperature
  node.send('check-temp', { gauge: 'main' }, function (err, response) {
    if (response.data.temp > 600) {
      // sound the alarm
    }
  }, 100);
});

API Docs

See here.

Keywords

FAQs

Package last updated on 06 Aug 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