thin-edge / thin-edge.io

The open edge framework for lightweight IoT devices
https://thin-edge.io
Apache License 2.0
210 stars 54 forks source link

configurable MQTT keepalive/ping interval for cloud connections #2939

Open reubenmiller opened 2 weeks ago

reubenmiller commented 2 weeks ago

Is your feature improvement request related to a problem? Please describe.

Allow control over the ping interval so that it is aligned with the different cloud requirements and it could be used to reduce some of the traffic for idle connections for those users who want to reduce the bandwidth by reducing the number of pings sent on idle connections.

It must also be noted that increasing the MQTT PING interval also affects how quickly the MQTT client detects whether the MQTT connection has been lost. Users should adjust the value with care, and they should verify that the interval is compatible with the cloud's requirements, as generally each cloud could also have additional settings on the load balancer to also disconnect idle connections after a period of time, and if the PING interval is above the idle connection setting, then it will also lead to the connection being closed by the server resulting in more traffic due to the reestablishment of the connection and the associated TLS handshake.

Describe the solution you'd like

A new tedge configuration value which is used by the bridge functionality (either mosquitto or the built-in bridge) to set MQTT PING keep-alive/ping interval:

Describe alternatives you've considered

Additional context