Alert on device disconnect

Hi

is there any way i can get an alert when the device disconnects from the particle cloud ? Currently i can only know if I use the ping command or run a diagnostic.

Due to the protocols used, the online status isn’t to be trusted. It only pings the cloud every once in a while, so a continuous connection can’t reliably be showed on that end. If you want to know the actual status, you’d have to either ping the device from the cloud, or send pings in a quicker interval from the device to your endpoint and check on it there.

how to achieve this ?

You’d need a service of your own, or a 3rd party service which can listen to your calls and let you know if the last one was too long ago.