rickshaw4iot
rickshaw4iot copied to clipboard
enhancement: Retries if connection fails
In realtime.js if connection to iot platform fails there is no retry.
var connectOptions = new Object();
connectOptions.keepAliveInterval = 3600;
connectOptions.useSSL=true;
connectOptions.userName=api_key;
connectOptions.password=auth_token;
connectOptions.onSuccess = function() {
console.log("MQTT connected to host: "+client.host+" port : "+client.port+" at " + Date.now());
}
connectOptions.onFailure = function(e) {
console.log("MQTT connection failed at " + Date.now() + "\nerror: " + e.errorCode + " : " + e.errorMessage);
}
console.log("about to connect to " + client.host);
client.connect(connectOptions);
Would it be connectOptions.onFailure = function(e) { .... } (line 60 of realtime.js) the right place to handle retry logic?
Sorry if it's a silly question but I don't have much javascript experience.