5 years, 3 months ago.

MQTT connection get lost, client.isConnected() method always return true.

Hi everyone,

I'm facing a problem in MQTT library with alive connection issue. I need to publish my MQTT message when i receive something on Serial. When it starts the client get connected to the Mosquitto broker and if i send something on Serial, the message get published on Broker. The problem occurs when the program is in idle state waiting for some messages on Serial to arrive. The MQTT connection get lost from MQTT broker, and if i check the connection status before publishing my message using client.isConnected() method always return true even if the connection is lost. Now when i try to publish the message in lost connection state, the program get stuck it there.

Any help would be really appreciated.

Question relating to:

Deprecated This team is no longer maintained, please use: https://github.com/ARMmbed/mbed-mqtt instead.

Hello, Is this the same problem as the same question you were asking a week ago in this thread? https://os.mbed.com/questions/81951/MQTT-connection-get-lost-using-it-with-T/. If it is, I just posted a comment. Sorry for the late reply. I have been very the last couple week.


posted by Peter Nguyen 14 Aug 2018

Hi Peter,

Yes it's the same question, no one replies there so i opened a new thread to get some attention..lol.

I have tried different things to resolve the problem, but it's still there and i'm kinda stuck in that problem.

Any help would be really appreciated.

posted by sohaib qamar 14 Aug 2018
Be the first to answer this question.