Skip to content

minrk/zmq-prebuilt

 
 

Repository files navigation

zmq-prebuilt   Build Status  Build status

ØMQ bindings for node.js.

Installation

$ npm install zmq-prebuilt

We rely on prebuild. Prepare to be amazed at the wonders of binaries.

Developer Installation

To set up zmq-prebuilt for development, clone and fork this repository. If you are running on Linux or OS X, you will need to have automake, autoconf, and libtools. These can be installed using brew.

$ ./build_libzmq.sh
$ npm install

You can run then run the test suite.

$ npm test

Or run some of the example applications.

$ node examples/subber.js

Supported operating systems

  • OS X/Darwin 64-bit
  • Linux 64-bit
  • Windows (we'll get this one up soon, we're so close.)

Usage

Everywhere you used require(zmq) in your code base before, replace it with zmq-prebuilt.

Examples

Push/Pull

// producer.js
var zmq = require('zmq-prebuilt')
  , sock = zmq.socket('push');

sock.bindSync('tcp://127.0.0.1:3000');
console.log('Producer bound to port 3000');

setInterval(function(){
  console.log('sending work');
  sock.send('some work');
}, 500);
// worker.js
var zmq = require('zmq-prebuilt')
  , sock = zmq.socket('pull');

sock.connect('tcp://127.0.0.1:3000');
console.log('Worker connected to port 3000');

sock.on('message', function(msg){
  console.log('work: %s', msg.toString());
});

Pub/Sub

// pubber.js
var zmq = require('zmq-prebuilt')
  , sock = zmq.socket('pub');

sock.bindSync('tcp://127.0.0.1:3000');
console.log('Publisher bound to port 3000');

setInterval(function(){
  console.log('sending a multipart message envelope');
  sock.send(['kitty cats', 'meow!']);
}, 500);
// subber.js
var zmq = require('zmq-prebuilt')
  , sock = zmq.socket('sub');

sock.connect('tcp://127.0.0.1:3000');
sock.subscribe('kitty cats');
console.log('Subscriber connected to port 3000');

sock.on('message', function(topic, message) {
  console.log('received a message related to:', topic, 'containing message:', message);
});

Release

After an npm release, go through the following to create the actual prebuilds:

Shipping Linux binaries

docker build -t zmqprebuilt .
docker run -it zmqprebuilt prebuild --all -u $GITHUB_TOKEN

Shipping OS X binaries

From a Mac:

npm install
npm install -g prebuild
prebuild --all -u $GITHUB_TOKEN

Shipping Windows binaries

TODO

About

Node.js bindings to the zeromq library

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 51.5%
  • C++ 32.6%
  • C 13.8%
  • Python 1.2%
  • Other 0.9%