vue-paho-mqtt icon indicating copy to clipboard operation
vue-paho-mqtt copied to clipboard

[Feature] Multiple reconnect attempts

Open andypotato opened this issue 7 months ago • 1 comments

Currently your library supports automatically reconnecting to the MQTT broker. However there will be only ever be one reconnection attempt.

If the reconnection attempt fails, the library will stop reconnecting and not try again. This may be the desired behavior in some cases, but in many real-world cases you would expect to retry reconnecting until the MQTT becomes available again.

How about a configuration parameter maxReconnects which can either take a number (for example "3") for maximum of 3 reconnection attempts. If you set it to "-1", then it will try infinite times to reconnect.

maxReconnects: 1 // current behavior (default)
maxReconnects: 3 // try up to 3 times
maxReconnects: -1 // try infinite times (until MQTT is back up)

andypotato avatar Jul 21 '24 22:07 andypotato