You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
These messages can be parsed with dashtx (npm install --save dashtx) and dashtx-inspect (npm install --location=global dashtx)
"use strict";letFs=require("node:fs/promises");// TODO v6-betaletzmq=require("zeromq");// TODO read from JSON configletconfig={zmq: "tcp://10.11.5.101:28332",};asyncfunctionmain(){letzmqSubSocket=zmq.socket("sub");console.info(`[INFO] ZMQ opening socket to '${config.zmq}'`);// workaround for https://github.com/zeromq/zeromq.js/issues/574vartimeout=setTimeout(function(){// neither accepting nor rejecting - either invalid or firewalled (DROP)console.error(`ZMQ address '${config.zmq}' cannot be reached`);process.exit(1);},7*1000);zmqSubSocket.on("connect",function(fd,endPoint){console.info("ZMQ connected to:",endPoint);clearTimeout(timeout);timeout=null;});zmqSubSocket.on("connect_delay",function(fd,endPoint){console.warn("ZMQ connection delay:",endPoint);clearTimeout(timeout);timeout=null;});zmqSubSocket.subscribe("rawtxlock");zmqSubSocket.on("message",function(topic,message){vartopicString=topic.toString("utf8");console.log("[ZMQ]",topicString,message.toString("hex"));});zmqSubSocket.on("monitor_error",function(err){console.warn("Error in monitoring: %s, will restart monitoring in 5 seconds",err,);setTimeout(function(){zmqSubSocket.monitor(500,0);},5000);});// IMPORTANT: monitor MUST run for "connect" messageszmqSubSocket.monitor(500,0);zmqSubSocket.connect(config.zmq);}main().catch(function(err){console.error(err.stack);process.exit(1);});
The text was updated successfully, but these errors were encountered:
ZeroMQ.js@v6 (beta-not-beta)
To-Dos:
https://github.com/zeromq/zeromq.js/blob/62f6e252f530ea05c86be15b06a58214eac1b34d/src/observer.cc#L51
Notes:
receive()
is in c++ land:https://github.com/zeromq/zeromq.js/blob/62f6e252f530ea05c86be15b06a58214eac1b34d/src/socket.cc#L307
asyncInterator
is generic generated by TypeScript:https://github.com/zeromq/zeromq.js/blob/62f6e252f530ea05c86be15b06a58214eac1b34d/src/index.ts#L291C1-L292C1
ZeroMQ.js@v5 (deprecated-not-deprecated)
monitor
andconnect
!dashtx
(npm install --save dashtx
) anddashtx-inspect
(npm install --location=global dashtx
)The text was updated successfully, but these errors were encountered: