Replies: 2 comments 32 replies
-
Could you not just write while true {
do {
try await client.connect()
break
} catch MQTTError.failedToConnect {
try await Task.sleep(for: someExponentialIncreasingTimeAmount)
}
} |
Beta Was this translation helpful? Give feedback.
-
Is there a better mechanism to use than client.isActive() to determine if the connection is still valid? I'm still seeing .isActive() true when the network interface/connection has been brought down, not really allowing me to use it to impl my own retry mechanism. EDIT: looks like my interval for checking isAlive was shorter than the keepAlive interval. I was setting it near-ish the ping interval thinking a failed ping would result in it closing. But the CloseListener is called around when the keepAlive interval expires |
Beta Was this translation helpful? Give feedback.
-
Hey guys! I'm currently using this library and I saw that, when the client fails it first connection, there is no chance of actually trying to reconnect automatically. My request would be: have a reconnect option that could be activated in the MQTT client's configuration. Would that be possible to do?
Beta Was this translation helpful? Give feedback.
All reactions