eclipse-paho / eclipse-paho/paho.mqtt.javascript

[Feature Request] Set custom reconnect interval and/or set max reconnect interval

Open
#206 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
1.2k
Forks
466
PR merge metrics
No merged PRs in 30d

Description

When locking the screen from a mobile device, the client's connection is severed. If the screen is immediately opened then the client is reconnected and everything is fine. However, if the screen is left locked for a few minutes then the client takes up to two minutes to reconnect.

According to the [docs](https://www.eclipse.org/paho/files/jsdoc/Paho.MQTT.Client.html), this is because the reconnect interval doubles every failure, maxing out at two minutes.

This is an understandable feature and a great default, however, it would be very nice to be able to set a consistent interval. Or perhaps be able to set the max reconnect interval along with the initial reconnect interval. Similar to the reconnect_delay_set() method for the python version.

I see from #48 that this feature was part of the plan for the automatic reconnect and disconnect. It seems that 'reconnectInterval' was supposed to be an option for the connection options object. However, it does not work today so I'm not sure if it was never added in or if it was later taken out but this would be a very worthwhile feature to have.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.