2 months, 1 week ago.
MQTT connection get lost, client.isConnected() method always return true.
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:
To post an answer, please log in.