Skip to content

Commit

Permalink
adding draft connect method.
Browse files Browse the repository at this point in the history
  • Loading branch information
vitaly-t committed Jul 7, 2017
1 parent 54572be commit 6b32e08
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,32 @@

};

/*
function reconnect(delays, attempt) {
var delay = attempt < delays.length ? delays[attempt] : delays[delays.length - 1];
return new Promise(function (resolve, reject) {
setTimeout(function () {
config.connect()
.then(function (obj) {
notifyStatus('connected', {
connection: obj
});
resolve(obj);
})
.catch(function (error) {
if (++attempt < maxAttempts) {
reconnect(delay, attempt)
.then(resolve)
.catch(reject);
} else {
reject(error);
}
});
}, delay);
});
}
*/

}

function notifyStatus(cb, status, data) {
Expand Down

0 comments on commit 6b32e08

Please sign in to comment.