eazy - a simple wrapper on top of node-zmq to make life even easier
Eazy (spelled with a Z instead of an S, take note) aims to simplify the zero-mq interface for node. What it does is provide an easy way to create persistent socket connections that you can pass to different modules in your process to be reused automatically, as well as closing the sockets properly when the process exits or fails.
Installation
npm install eazy
Usage
var eazy = require('eazy');
var sockPull = eazy.socket('pull', { proto : 'inproc', addr : 'test-run' });
var sockPush = eazy.socket('push', { proto : 'inproc', addr : 'test-run' });
sockPull
.bind() // <--- you have to explicitly bind the host sockets
.recv(function (err, json) {
// The data passed in "json" is automatically parsed into JSON
console.log(json); // <--- should output { foo : 'bar' }
});
sockPush // <--- no need to connect. Connections are lazy activated
.send({ foo : 'bar' });
Transports supported:
- PUSH-PULL
- REQ-REP
License (IMPORTANT!)
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2004 Ruben L Z Tan <soggie@gmail.com>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. You just DO WHAT THE FUCK YOU WANT TO.