Open miketran78727 opened 8 years ago
This sounds reasonable, we'll also have to add a flag that prevents the reconnect logic attempting to increment or reset the reconnectInterval if it has been set this way.
Hi James, I will submit a pull request for this in the near future :)
There is already a setting in the connect options: automaticReconnectMaxDelay. If minDelay and MaxDelay are set to the same value, then there will be a fixed reconnect interval.
There is already a setting in the connect options: automaticReconnectMaxDelay. If minDelay and MaxDelay are set to the same value, then there will be a fixed reconnect interval.
see #864
Please fill out the form below before submitting, thank you!
Currently, the reconnect interval starts from 1 second, then double the previous interval in the next attempt, with the max interval of 2 minutes. This implement works nicely for short interruption of network connectivity, but it does not work well for devices move between networks (e.g. cellular to WIFI) or in and out of a network. When the network layer and security settle, it is desirable to reconnect to the MQTT broker as soon as possible instead of the maximum 2-minute interval.
I am proposing an option to allow the application to set a fixed reconnect interval. If this option is not specified, the default behavior is the same as before.