Created
February 24, 2012 22:33
-
-
Save szastupov/1904237 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
var zmq = require('../../') | |
, sock = zmq.socket('push'); | |
sock.bindSync('tcp://127.0.0.1:5556'); | |
setInterval(function(){ | |
console.log('sending pub'); | |
sock.send('10001 some pub'); | |
}, 500); |
This file contains hidden or 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
var zmq = require('../../'); | |
var receiver = zmq.socket('pull'); | |
receiver.connect("tcp://localhost:3000"); | |
console.log("receiver connected") | |
var subscriber = zmq.socket('sub'); | |
subscriber.connect("tcp://localhost:5556"); | |
subscriber.subscribe("10001 "); | |
console.log("subscriber connected") | |
receiver.on('message', function(msg){ | |
console.log('work: %s', msg.toString()); | |
}); | |
subscriber.on('message', function(msg) { | |
console.log('sub: %s', msg.toString()); | |
}); | |
console.log("setup is done"); |
This file contains hidden or 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
var zmq = require('../../') | |
, 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()); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment