thin-edge / thin-edge.io

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

Allow the MQTT bridge keep alive interval to be configured #3068

Open jarhodes314 opened 3 weeks ago

jarhodes314 commented 3 weeks ago

Is your feature improvement request related to a problem? Please describe. A customer is trying to minimise the data used by thin-edge. In doing this, they want to reduce the frequency of the MQTT keep-alive messages sent by mosquitto (and the built-in bridge) to the cloud.

Describe the solution you'd like We should add a configuration e.g. mqtt.bridge.keepalive_interval that affects the mosquitto bridge configuration and the built-in bridge. To configure it in mosquitto, we need to add the line:

keepalive_interval <no of seconds>

In the built-in bridge, we'll need to call set_keep_alive on the cloud connection to configure this parameter.

Both default to 60 seconds, so that should be the configuration default.

reubenmiller commented 2 weeks ago

Though we'll have to include a note to the users about what are some acceptable Cumulocity IoT keep alive values, because different IoT providers will have different recommended/acceptable values (I'm fairly certain that Cumulocity IoT will reject connections that have a keep alive in the range of 15 minutes etc.)