You are viewing a single comment's thread from:

RE: Fixing "Error: connect ETIMEDOUT ..." for SteemJS below 0.7.0 (NodeJS)

in #steemdev7 years ago

When I encounter this, this is what I do:


function execute() {
    steem.api.streamOperations((err, results) => {
        return new Promise((resolve, reject) => {
            if (err) {
                console.log("Unable to stream operations %s", err)
                return reject(err)
            }
            return resolve(results) // results [ "operation name", operation:{} ]
        })
        .spread((operation_name, operation) => {
            switch(operation_name) {
                case "comment":
                    return processComment(operation);
                break;
                default:
            }
        })
        .catch((err) => {
            // Probably lost connection with websocket. Restart communication.
            execute();
        });
    });
}

Notice, I just push it back onto the stack.

Sort:  

Great information here... will definitely look closer at the code when i can get on my laptop... thx a bunch

Coin Marketplace

STEEM 0.16
TRX 0.17
JST 0.029
BTC 69437.28
ETH 2488.70
USDT 1.00
SBD 2.54