13.08.2021, 16:11
Hi,
I've been testing this code using one LM as broker+publisher and a second one as publisher.
I realized that when rebooting the LM that is not the broker, it can't reconnect until I disable and enable the script...
This is the log:
* arg: 1
* string: mqtt disconnect
* arg: 2
* bool: false
* arg: 3
* number: 14
* arg: 4
* string: unexpected disconnect
* arg: 5
* nil
I've added the line "broker = nil" here and now it's working, but i'm not sure that it is the best way to solve it...
Is it correct?
Thanks!
I've been testing this code using one LM as broker+publisher and a second one as publisher.
I realized that when rebooting the LM that is not the broker, it can't reconnect until I disable and enable the script...
This is the log:
* arg: 1
* string: mqtt disconnect
* arg: 2
* bool: false
* arg: 3
* number: 14
* arg: 4
* string: unexpected disconnect
* arg: 5
* nil
I've added the line "broker = nil" here and now it's working, but i'm not sure that it is the best way to solve it...
Code:
mclient.ON_DISCONNECT = function(...)
log('mqtt disconnect', ...)
mclientfd = nil
broker = nil
end
Is it correct?
Thanks!