Replies: 3 comments
-
I don't know if there's a way to manually send a ping, but I am curious how you are detecting the connection lost where the library is not. |
Beta Was this translation helpful? Give feedback.
-
fpagliughi, I'm reading the output of "ip monitor" to watch for changes to interfaces and IP addresses, and thus detecting when the ppp0 interface goes down, out of band. The tcp socket stays alive, and you can keep writing to it until a tcp-level timeout happens or the tcp buffers fill up. I can't convince myself one way or the other if this is a pppd/ppp kernel module bug. |
Beta Was this translation helpful? Give feedback.
-
Oh, wow, a PPP connection! That's what I was using when I started with MQTT long ago, but it's been a while. IIRC, I think we just dialed down the KeepAliveInterval to ~20sec, and that was good enough for us. You can go lower, but you need to balance the quick notification with the increased bandwidth. I don't think this is a bug, but rather the way PPP works - on Linux, at least. The TCP layer isn't notified that the PPP link disappeared, and waits for the TCP timeout. In this situation, today, I would probably look to hook into an OS notification for the dropped interface, disconnect the MQTT client, and then try to reconnect. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Using the C async API, is there a way to request a ping be sent immediately, as if keepAliveInterval were turned on?
I'm in a situation where the internet connection to will drop (which I can detect), but leave the TCP connection open. The server requires QOS=0, so many messages can go out over the dead connection before some TCP timeout eventually detects the lost connection.
If I could send out a keepalive-style ping whenever I detected a connection drop, the paho lib would immediately detect the issue, and my ordinary reconnect logic would happily take over.
Beta Was this translation helpful? Give feedback.
All reactions