// ZMQ fun socket.bind(portPub, function (err) { if (err) throw err; console.log(`bound to ${portPub}`); });
async function run() { await reply.bind("tcp://127.0.0.1:7000"); const zmqm = new ZmqMiddlewareManager(reply); zmqm.use(jsonMiddleware.json()); zmqm.use({ inbound: function(message, next) { console.log("Received: ", message.data); if (message.data.action === "ping") { this.send({ action: "pong", echo: message.data.echo }); } next(); } }); }
publisher.bind('tcp://*:60400', err => { if (err) { throw err; } console.log('Listening for zmq subscribers....'); });
responder.bind('tcp://127.0.0.1:60401', err => { console.log('Listening...'); });