Fix for reconnect if MQTT server goes down.

This commit is contained in:
id628 authored and GitHub committed 2023-07-10 18:30:41 -04:00
1 parent da06453ac5
commit c8e6e6fa0d
1 file changed
+11
+11
View File
@@ -577,3 +577,14 @@ exports.connect = function (options) {
mqtt.connect();
return mqtt;
};
// Added by heroash88:
MQTT.on('disconnected', function() {
mqtt.connect();
});
MQTT.on('error', function() {
setTimeout(function (){
mqtt.connect();
}, 1000);
});