Created
June 9, 2012 23:02
-
-
Save ceejbot/2902944 to your computer and use it in GitHub Desktop.
ZeroMQ req socket example for node.js
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
var zmq = require('zmq'); | |
var requester = zmq.socket('req'); | |
requester.on('message', function(data) | |
{ | |
console.log('got messsage: ' + data.toString('utf8')); | |
}); | |
var endpoint = 'tcp://127.0.0.1:3009'; | |
requester.connect(endpoint); | |
console.log('requesting on ' + endpoint); | |
var test = { foo: 'bar' }; | |
requester.send(JSON.stringify(test)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment