Open dervur opened 3 years ago
//If client is not connected, connect it
if (client.isConnected())
connectMQTT();
Your comment does not match your action, you are testing for true and connecting when it is connected.
I'm sorry I copied the wrong code, that was to test only if it was a problem of the isconnected() code, the fact is that with the code below it doesn't work.
if (!client.isConnected())
connectMQTT();
In fact it continues to reconnect every 20 second. If I comment that section of the code and I try to publish something else in the topics the ESP01 has subscribed it continues receiving them, thence I think it is indeed still online (confirmed by the fact that the broker doesn't send the last will to other clients)
In the screenshot it is even possible to see that the client receives even its own last will (green square brackets) before subscribing to the topic which is very odd...
Hello there,
I'm trying to use a modified version of the sample code for Arduino (I'm using an ESP01 with arduino's framework) however, in the main loop the function isconnected() always returns a false value instead of a true one, in fact the client is receiving and sending messages with no problem it is indeed connected, however for this function the client is somehow not connected. Do you have any idea of what is the issue here?
This is my code below (I only cleared my Wifi and personal broker fields for privacy reasons, but I have the problem both with my broker and with hiveMQ's public broker, so I left only hivemq's broker field):
Kind regards, Vur