Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
ZeroMQ req socket example for node.js
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
You can’t perform that action at this time.