marvinroger / async-mqtt-client

📶 An Arduino for ESP8266 asynchronous MQTT client implementation
MIT License
849 stars 268 forks source link

reconnect mqtt but no call onConnect and onDisconnect... #277

Open acer1204 opened 2 years ago

acer1204 commented 2 years ago

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...

joelgamal commented 2 years ago

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

bertmelis commented 2 years ago

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.

ajinkya-open commented 1 year ago

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 () ...