Device connected state update rate

I’m checking the connected state of the Photon by sending a REST call to get the device information. I’ve noticed that the “connected” variable keeps giving back true, while I actually unplugged the device.

I also checked the device in Particle Build and the states still fades blue and says “Device Connected”.

How often is this connectedness updated? I now have the device unplugged for about 2 minutes and it stays indicating it’s connected. So I’m also wondering what the use case is of that connected variable, if it doesn’t actually gives back the right information.

For sure I’m checking the right device, because I did the rainbow blink (of course when it really was connected :slight_smile:).

Not exactly sure on the timing, but I thought it had something to do with the ‘protocol disconnecting after a certain time of inactivity’. the timeout on that is probably the limiting factor. An event is published when the cloud notices it’s online, you you can check that for a rough guesstimate of the times involved.

Probably I’ll at a timeout to my XMLHttpRequests then:

var xhttp = new XMLHttpRequest();

    xhttp.timeout = 5000;
    xhttp.ontimeout = function(e) {
        console.log('Is your Particle device online?');