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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.