Skip to content

Instantly share code, notes, and snippets.

@jfd
Created April 13, 2011 18:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jfd/918098 to your computer and use it in GitHub Desktop.
Save jfd/918098 to your computer and use it in GitHub Desktop.
Publisher
zmq = require('zeromq');
s = zmq.createSocket('pub');
count = 0;
function send() {
for (var i = 0; i < 1000; i++) {
s.send("data");
}
}
s.bind("ipc://unbalanced", function() {
console.log("bind");
setInterval(send, 1);
});
zmq = require('zeromq');
s = zmq.createSocket('sub');
count = 0;
s._subscribe = "";
s.on("message", function(data) {
if (count == 0) {
console.time("speedtest:");
}
if (count++ == 100000) {
console.timeEnd("speedtest:");
s.close();
}
});
s.connect("ipc://unbalanced");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment