Created
April 13, 2011 18:37
-
-
Save jfd/918098 to your computer and use it in GitHub Desktop.
Publisher
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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