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

zmq

Package Overview
Dependencies
Maintainers
3
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

zmq - npm Package Compare versions

Comparing version 2.8.0 to 2.9.0

test/socket.pair.js

9

History.md

@@ -0,1 +1,10 @@

2.9.0 / 2015-01-05
==================
* More unit tests [bluebery and reqshark]
* More reliable testing [f34rdotcom and kkoopa]
* Improved ReadMe [dminkovsky and skibz]
* Support for zmq_proxy sockets [reqshark]
* Removed "docs" and related deps in favor of ReadMe [reqshark]
2.8.0 / 2014-08-27

@@ -2,0 +11,0 @@ ==================

@@ -600,1 +600,72 @@ /**

};
/**
* JS based on API characteristics of the native zmq_proxy()
*/
function proxy (frontend, backend, capture){
switch(frontend.type+'/'+backend.type){
case 'push/pull':
case 'pull/push':
case 'xpub/xsub':
if(capture){
frontend.on('message',function (msg){
backend.send(msg);
});
backend.on('message',function (msg){
frontend.send(msg);
//forwarding messages over capture socket
capture.send(msg);
});
} else {
//no capture socket provided, just forwarding msgs to respective sockets
frontend.on('message',function (msg){
backend.send(msg);
});
backend.on('message',function (msg){
frontend.send(msg);
});
}
break;
case 'router/dealer':
case 'xrep/xreq':
if(capture){
//forwarding router/dealer pack signature: id, delimiter, msg
frontend.on('message',function (id,delimiter,msg){
backend.send([id,delimiter,msg]);
});
backend.on('message',function (id,delimiter,msg){
frontend.send([id,delimiter,msg]);
//forwarding message to the capture socket
capture.send(msg);
});
} else {
//forwarding router/dealer signatures without capture
frontend.on('message',function (id,delimiter,msg){
backend.send([id,delimiter,msg]);
});
backend.on('message',function (id,delimiter,msg){
frontend.send([id,delimiter,msg]);
});
}
break;
default:
throw new Error('wrong socket order to proxy');
}
}
exports.proxy = proxy;

9

package.json
{
"name": "zmq",
"version": "2.8.0",
"version": "2.9.0",
"description": "Bindings for node.js to zeromq",

@@ -16,10 +16,7 @@ "main": "index",

"should": "2.1.x",
"batch": "*",
"jade": "*",
"dox": "*",
"semver": "*",
"semver": "~4.1.1",
"mocha": "~1.13.0"
},
"engines": {
"node": ">=0.7.9"
"node": ">=0.8"
},

@@ -26,0 +23,0 @@ "scripts": {

@@ -9,11 +9,27 @@ [![Build Status](https://travis-ci.org/JustinTulloss/zeromq.node.png)](https://travis-ci.org/JustinTulloss/zeromq.node)

[Install zmq package](http://www.zeromq.org/intro:get-the-software) first.
First make sure [ZeroMQ is installed](http://www.zeromq.org/intro:get-the-software).
This module is compatible with ZeroMQ versions 2, 3 and 4. The installation
process varies by platform, but headers are mandatory. Most Linux distributions
provide these headers with `-devel` packages like `zeromq-devel` or
`zeromq3-devel`. Homebrew for OS X provides versions 4 and 3 with packages
`zeromq` and `zeromq3`, respectively. A
[Chris Lea PPA](https://launchpad.net/~chris-lea/+archive/ubuntu/zeromq)
is available for Debian-like users who want a version newer than currently
provided by their distribution. Windows is supported but not actively
maintained.
Note: For zap support with versions >=4 you need to have libzmq built and linked
against libsodium. Check the Travis configuration for a list of what is tested
and therefore known to work.
With ZeroMQ headers installed, you can install and use this module:
$ npm install zmq
## Example
## Examples
producer.js:
### Push/Pull
```js
// producer.js
var zmq = require('zmq')

@@ -31,6 +47,4 @@ , sock = zmq.socket('push');

worker.js:
```js
// worker.js
var zmq = require('zmq')

@@ -47,2 +61,32 @@ , sock = zmq.socket('pull');

### Pub/Sub
```js
// pubber.js
var zmq = require('zmq')
, 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);
```
```js
// subber.js
var zmq = require('zmq')
, 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);
});
```
## Running tests

@@ -49,0 +93,0 @@

@@ -34,4 +34,4 @@ var zmq = require('..')

pull.bind('inproc://stuff', function(){
push.connect('inproc://stuff');
pull.bind('inproc://stuff_ssm', function(){
push.connect('inproc://stuff_ssm');
push.send('string');

@@ -53,4 +53,4 @@ push.send(15.99);

pull.bind('inproc://stuff', function(){
push.connect('inproc://stuff');
pull.bind('inproc://stuff_ssmm', function(){
push.connect('inproc://stuff_ssmm');
push.send(['string', 15.99, new Buffer('buffer')]);

@@ -72,4 +72,4 @@ });

pull.bind('inproc://stuff', function(){
push.connect('inproc://stuff');
pull.bind('inproc://stuff_sss', function(){
push.connect('inproc://stuff_sss');
push.send(['tobi', 'loki'], zmq.ZMQ_SNDMORE);

@@ -76,0 +76,0 @@ push.send(['jane', 'luna'], zmq.ZMQ_SNDMORE);

@@ -35,3 +35,3 @@ var zmq = require('..')

var addr = "inproc://stuff";
var addr = "inproc://stuff_ssps";

@@ -79,4 +79,4 @@ sub.bind(addr, function(){

sub.bind('inproc://stuff', function(){
pub.connect('inproc://stuff');
sub.bind('inproc://stuff_sspsf', function(){
pub.connect('inproc://stuff_sspsf');

@@ -83,0 +83,0 @@ // See comments on pub-sub test.

@@ -8,6 +8,7 @@ var zmq = require('..')

var zap = require('./zap')
, zapSocket, rep, req;
, zapSocket, rep, req, count = 0;
beforeEach(function(){
zapSocket = zap.start();
count++;
zapSocket = zap.start(count);
rep = zmq.socket('rep');

@@ -132,2 +133,2 @@ req = zmq.socket('req');

});
});
});

@@ -7,3 +7,3 @@ // This is mainly for testing that the security mechanisms themselves are working

module.exports.start = function() {
module.exports.start = function(count) {
var zap = zmq.socket('router');

@@ -45,4 +45,4 @@ zap.on('message', function() {

zap.bindSync("inproc://zeromq.zap.01");
zap.bindSync("inproc://zeromq.zap.01."+count);
return zap;
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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