Fix for reconnect if MQTT server goes down.
This commit is contained in:
1 parent
da06453ac5
commit
c8e6e6fa0d
1 file changed
+11
@@ -577,3 +577,14 @@ exports.connect = function (options) {
|
|||||||
mqtt.connect();
|
mqtt.connect();
|
||||||
return mqtt;
|
return mqtt;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// Added by heroash88:
|
||||||
|
MQTT.on('disconnected', function() {
|
||||||
|
mqtt.connect();
|
||||||
|
});
|
||||||
|
MQTT.on('error', function() {
|
||||||
|
setTimeout(function (){
|
||||||
|
mqtt.connect();
|
||||||
|
}, 1000);
|
||||||
|
});
|
||||||
Reference in new issue
Block a user