I’m working through some code examples for the Diffusion JS API but I don’t understand the example on reconnection. What are the start
and abort
parameters of the reconnectionStrategy?
// Create a reconnection strategy that applies an exponential back-off
var reconnectionStrategy = (function() {
return function(start, abort) {
var wait = Math.min(Math.pow(2, attempts++) * 100, maximumAttemptInterval);
// Wait and then try to start the reconnection attempt
setTimeout(start, wait);
};
})();
// Connect to the server.
diffusion.connect({
host : 'diffusion.example.com',
port : 443,
secure : true,
principal : 'control',
credentials : 'password',
reconnect : {
timeout : maximumTimeoutDuration,
strategy : reconnectionStrategy
}
}).then(function(session) {
Taken from https://github.com/pushtechnology/diffusion-examples/blob/master/js/examples/reconnect.js