Skip to content
This repository has been archived by the owner on Apr 24, 2020. It is now read-only.

router/dealer proxy doesn't forward multipart msgs correctly #606

Open
artiommorozov opened this issue Sep 5, 2018 · 0 comments
Open

router/dealer proxy doesn't forward multipart msgs correctly #606

artiommorozov opened this issue Sep 5, 2018 · 0 comments

Comments

@artiommorozov
Copy link

Besides multipart messages as in example below, this issue prevents chaining router/dealer proxies

const zmq = require('zeromq');

function viaProxy() {
	
	const addr1 = "tcp://127.0.0.1:8901";
	const addr2 = "tcp://127.0.0.1:8902";
	
	const req = zmq.socket('req');
	req.connect(addr1);

	const rep = zmq.socket('rep');
	rep.connect(addr2);
	rep.on('message', (...args) => { console.log(`via proxy <- ${args.length} ${args.join(',')}`); });

	const proxy1 = zmq.socket('router');
	proxy1.bindSync(addr1);

	const proxy2 = zmq.socket('dealer');
	proxy2.bindSync(addr2);

	zmq.proxy(proxy1, proxy2);

	req.send(['a', 'b']);
	rep.send('ack');
}

function direct1() {
	const addr1 = "tcp://127.0.0.1:8911";
	const addr2 = "tcp://127.0.0.1:8912";
	
	const req = zmq.socket('req');
	req.connect(addr1);

	const rep = zmq.socket('rep');
	rep.bindSync(addr1);
	rep.on('message', (...args) => { console.log(`direct <- ${args.length} ${args.join(',')}`); });
	
	req.send(['a', 'b']);
	rep.send('ack');	
}

direct1();
viaProxy();

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant