How does the cloud to spot disconnection of a core / photon?

I had run the local server in my PI for a while, today I happened to find that the local server could not respond to offline event of a photon immediately if the photon is offline for a unexpected reason. For example, I had a photon connected to local server, and it was then unplugged out of power, so the connection between photon and server was finished and I expect the local server to tell me the photon is offline, but I waited for minutes with nothing until I reconnected that photon to the local server, then both offline and online event pop up.

I haven’t looked into the code, but would there be faster way to detect the disconnection of the photon?

Hi @helxsz,

Good question! As you’ve noticed, sometimes the TCP socket doesn’t get cleaned up properly, and a session can be left open for a time. To help address this, the device and the cloud will periodically ping eachother in certain circumstances to check and make sure the connection is still alive. As it happens, I just released another release that improves this behavior on the main cloud, and makes it more configurable.

I’m not sure where this would be on the roadmap for the local server, but we can add it if it’s in big demand.


Thanks,@Dave, as you mentioned the device and the cloud will periodically ping each other, I want to know does it mean that let the device normally ping the cloud periodically, if cloud doesn’t receive the ping for some time, it would clear the connection, is it ? and how to let the cloud to clear the connection?