You are viewing a single comment's thread from:
RE: Fixing "Error: connect ETIMEDOUT ..." for SteemJS below 0.7.0 (NodeJS)
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.
Great information here... will definitely look closer at the code when i can get on my laptop... thx a bunch