-1

I started to listen to the "wss://ws.blockchain.info/inv" websocket address in the link below, but none of the transactions I made were sent to the messages. Later, when I tried the blockcyper's websocket, all the transactions came. Currently, I am looking for a free websocket service, not a paid one.

https://www.blockchain.com/explorer/api/api_websocket

1 Answer 1

0

I had to solve the problem by listening to all transactions and checking the address as follows.

ws.addEventListener('open', () => {
    ws.send(JSON.stringify({
        "op": "unconfirmed_sub"
    }));
});

ws.addEventListener('message', (res) => {
    let data = JSON.parse(res.data);
    let outs = data.x.out;
    let out = outs.find(o => {
        return String(o.addr).toLowerCase() == receiver.toLowerCase();
    });
    if (out) {
        setTimeout(() => {
           startCallback(data);
        }, 6000);
    }
});

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.