Blockchain API address subscription doesn't work

0

So, I'm using the API provided by blockchain.com to track specific bitcoin addresses. This requires a websocket which I installed. It works for about everything except for the address subscription; it works when I ping, call a specific address and even when I track blocks in general.

Node.js

var WebSocketClient = require('websocket').client;
var client = new WebSocketClient();

client.on('connectFailed', function (error) {
    console.log('Connect Error: ' + error.toString());
});

client.on('connect', function (connection) {
    console.log('WebSocket Client Connected');
    connection.on('error', function (error) {
        console.log("Connection Error: " + error.toString());
    });
    connection.on('close', function () {
        console.log('echo-protocol Connection Closed');
    });
    connection.on('message', function (message) {
        if (message.type === 'utf8') {
            console.log(JSON.parse(message.utf8Data));
        }
    });

    function send() {
        if (connection.connected) {
            connection.sendUTF(JSON.stringify({ "op": "addr_sub", "addr":"15wMBztWcRuexJqxeEHi6BCdL5FB2xiWqx"}));
        }
    }
    send();
});

client.connect('wss://ws.blockchain.info/inv');

Now, this code is very rough but it has worked for all cases except the aforementioned one. Am I doing something wrong here regarding sockets? As you can see, this transaction has been made at 3 hours ago or so and I've kept my program running for the last 10 hours but I've yet to receive any notification about a transaction on this address.

Any help is appreciated.

Branimir

Posted 2019-08-08T07:42:10.370

Reputation: 1

No answers