ZMQ
// Subscribe to transactions event
ZmqIriListener.Transactions += (sender, eventArgs) =>
{
Console.WriteLine("-----------------------");
Console.WriteLine(eventArgs.Transaction.Hash);
Console.WriteLine(eventArgs.Transaction.Address);
};
// Start listening to the event type (use MessageType.All) to subscribe to all events
var tokenSource = ZmqIriListener.Listen("tcp://node_url", MessageType.All);
// Listen for 60 seconds
var stopwatch = new Stopwatch();
stopwatch.Start();
while (stopwatch.ElapsedMilliseconds < 600000)
{
Thread.Sleep(100);
}
// Cancel the thread
tokenSource.Cancel();Last updated