emqx / CocoaMQTT

MQTT 5.0 client library for iOS and macOS written in Swift
https://www.emqx.com/en
Other
1.6k stars 420 forks source link

Disconnection doesn't always throw DidDisconnect #552

Open hothsolo opened 1 year ago

hothsolo commented 1 year ago

I'm having an issue keeping my connection open. First, I set the KeepAlive to the max, but that literally did not seem to do anything. I still disconnected about every 15-20 minute or so. That's fine, I just went into the DidDisconnect event and made it reconnect. This works fine most of the time. I left my app running overnight with the debug console open. This morning, the mqtt isn't receiving and there was never a DidDisconnect event, so it never triggered my reconnection.

Any ideas?

Thanks.

CJ

hothsolo commented 1 year ago

OK, now something very strange happened. Just after I wrote the first post, it suddenly did a disconnect. I'm not sure why. I didn't touch anything. When I got here 15 minutes ago, I sent a ping command and it did not respond. It's been down for at least 15 minutes (and probably longer, but I wasn't here to see it). Now suddenly it just disconnected and reconnected. Weird.

Cj