async-mqtt-client icon indicating copy to clipboard operation
async-mqtt-client copied to clipboard

reconnect mqtt but no call onConnect and onDisconnect...

Open acer1204 opened this issue 3 years ago • 3 comments

my wifi RSSI is -92. sometimes it will call mqtt.connect finish, but onConnect and onDisconnect will not call. if lost wifi long time(one hour or two hour). sometimes reconnect wifi success, but call mqtt.connect will no callback with onConnect or onDisconnect event.

in this stage, i try to use xTimerStart to recall mqtt.connect again, but it still no callback anything. is any way to clear/delete asyncmqttclient obj? i use disconnect() before connect, but it still not work...

acer1204 avatar Feb 02 '22 11:02 acer1204

same issue, after mqtt.connect() neither onConnect nor onDisconnect is called.

joelgamal avatar Feb 15 '22 09:02 joelgamal

Do you have the broker log?

PS I hate to say, but this lib is built on top of AsyncTCP and that library seems not to be mainainted. It might be that I cannot help with that.

bertmelis avatar Feb 15 '22 14:02 bertmelis

as per my observation , on connect works sometime and sometime not, i have copied forked async library to lib forlder of project platform io that is, its random behaviour

update

when i run sudo service mosquitto restart device dont run onconenct () but if run sudo service mosquitto stop and then sudo service mosquitto restart device runs onconnect()

may be library is holding previous state of connection for 2/3 loop of onconnect () ...

ajinkya-open avatar Jan 02 '23 05:01 ajinkya-open