zeromq.js icon indicating copy to clipboard operation
zeromq.js copied to clipboard

sub/pub how listen event?thanks!

Open blogwy opened this issue 4 years ago • 0 comments

how listen event on client? "message" event is worked,but "connect" and "disconnect" event no respond When I disconnect the server

this is code:

`var zmq = require('zeromq') , sock = zmq.socket('sub');

sock.on('message', function(topic, message) { console.log('received a message related to:', Buffer.from(topic, 'utf-8').toString(), 'containing message:', Buffer.from(message, 'utf-8').toString()); });

sock.connect('tcp://127.0.0.1:3000'); sock.subscribe(''); console.log('Subscriber connected to port 3000');

sock.on('connect', function () { console.log('connect success') })

sock.on('disconnect', function (err) { console.log(err) })`

blogwy avatar Apr 18 '20 17:04 blogwy