You are viewing a single comment's thread from:

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

in #steemdev6 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.20
TRX 0.13
JST 0.030
BTC 64623.67
ETH 3421.73
USDT 1.00
SBD 2.51