The following code snippet demonstrates that proxy is only forwarding the first part of a multipart message:
let zmq = require('zmq');
let subs = zmq.socket('xpub');
let pubs = zmq.socket('xsub');
subs.bindSync('tcp://127.0.0.1:3000');
pubs.bindSync('tcp://127.0.0.1:3001');
console.log('Proxy bound to to ports 3000 and 3001');
zmq.proxy(subs, pubs);
let subscriber = zmq.socket('sub');
subscriber.connect('tcp://127.0.0.1:3000');
subscriber.subscribe('');
console.log('Subscriber connected to port 3000');
subscriber.on('message', function (part1, part2) {
console.log(part1.toString(), ':', part2 && part2.toString());
});
let publisher = zmq.socket('pub');
publisher.connect('tcp://127.0.0.1:3001');
console.log('Publisher connected to port 3001');
setInterval(() => {
publisher.send(['foo', 'bar']);
}, 500);
wherein the publisher sends two parts, but the subscriber only receives the first part.
This change fixes the proxy so that it sends all parts to the subscriber.
The following code snippet demonstrates that proxy is only forwarding the first part of a multipart message:
wherein the publisher sends two parts, but the subscriber only receives the first part.
This change fixes the proxy so that it sends all parts to the subscriber.
Related issue https://github.com/JustinTulloss/zeromq.node/issues/412