const Centrifuge require centrifuge const WebSocket require ws const t

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
const Centrifuge = require("centrifuge")
const WebSocket = require("ws")
const tick = tx => {
console.log("new tx", tx)
}
const centrifuge = new Centrifuge("wss://explorer-rtm.minter.network/connection/websocket", {
debug: false,
websocket: WebSocket
})
centrifuge.on("connect", context => console.log("Centrifuge connected"))
centrifuge.subscribe("transactions").on("publish", ({data: tx}) => {
tick(tx) // !!!! <- обработка, выше
})
centrifuge.connect()