MQTT Clients disconnect after 90s
ibmartinez opened this issue · 3 comments
Hello!
I am using a complete MQTT system with a Mosquitto Broker and LabVIEW Clients (Publisher & Subscriber)
The publisher sends data to the broker with a very low frequency (each 2 hours) so both clients are most of the time without new data.
When I run the system, the TCP connections of the Publisher and the Subscriber close each 90 seconds. I say each 90 seconds because my clients reconnect with the broker 5 seconds after each disconnection.
If I change the frequency of the publish for example to 5 seconds, the TCP connections remain stable. It seems that there is something in the clients that close the connection if the channel remains without new data after 90 seconds.
I am trying to find if there is some timeout or keep alive field in the clients to solve this problem because I would like to send the data with the natural frequency and not each 5 seconds.
I have read the next article where some related info is shared:
https://stackoverflow.com/questions/48311061/how-to-configure-mosquitto-broker-to-increase-the-disconnection-time-to-mqtt-cli
Any help would be much appreciated! Thanks!
Hello @ibmartinez ,
Issue#11 might be relevant to what you're looking for
It's been reported that mosquitto changed their default keep alive setting from 60 to 0.
You can use the properties in the Connect packet payload to set the keep alive to another value. Those are exposed on the terminals of the MQTT:Connect VI, not in the connection configuration class.
If you need another way of maintaining the connection, you can use Ping packets at regular intervals and publish your data independently of the ping frequency. It shouldn't be needed though, so just a thought on case you need a workaround.
Hello,
In my case the best option is to use Ping packets at regular intervals as you told me. If I use the ping packets, the TCP connection remains stablished perfectly, it does not matter the frequency of the publish data.
Thank you for your support