4 months, 2 weeks ago.
MQTT permanent connection
How can I leave the connection always open waiting to receive a publication? Communication is lost after a few minutes. I do not know if there is a possibility that he will always listen, like other bookstores. Example of arduino pubsubclient. I played with yield but I do not get more than a couple of minutes. Thank you
Question relating to:
4 days, 13 hours ago.
I'm facing exactly the same issue using easyConnect and MQTT libraries. The connection get lost after some idle time. I need to keep the connection alive. Secondly, the method client.isConnected always return true even if it is not connected to the broker.
4 months, 1 week ago.
The MQTT server to which you are connecting could have some information on its log as to why the connection was broken. This would be a good place to start, if you have access to the log. Or you could connect to a locally running server like Mosquitto if the log is inaccessible to you.
My guess is that it's a keep alive timeout. Keep alive is an MQTT mechanism for ensuring that the TCP stays connected, and detecting closed connections. A 'ping' message is sent by the client library at intervals specified by the keep alive interval, and it expects a response from the server. A simple way to verify this is to set the keep alive interval to 0, which turns off this mechanism, and see if the behaviour changes. If the connection stays active then you need to call yield() at sufficient intervals, depending on the keep alive interval used, to allow the 'ping' exchange to complete.
To post an answer, please log in.