Open skidnight opened 1 year ago
Maybe you can set your own variables in the callback below.
func mqtt(_ mqtt: CocoaMQTT, didConnectAck ack: CocoaMQTTConnAck)
Then when ack != .accept
does not have 5 times or something else, you can set self.mClient?.autoReconnect = false.
I am having issues with keeping connection alive, in my case it seems to be manifesting due to a DNS failure (that I know my network is causing), but I think this may be a broader issue with reconnection. For reference I was able to keep the connection alive for over 4 hours in the background until this issue arose, but I've experienced the same failure in the foreground.
This is how I am setting up the client
These are the debug logs from the connection. Notice it attempts to connect, fails, says it is going to retry in 1s, receives a ConnAck and then disconnects. I would expect the connection to be retried in 2s after the failure. At this point the connection is never re-attempted by the library.
Eventually this state will end up with the library filling up its message buffers but the connection is never resumed. Should I be manually re-attempting the connection when I get a disconnect but with no error? Does attempting to publish when the connection is not established cause a disconnect?
Any help would be much appreciated. Thanks!