I am looking for a way to detect if my device is currently connected or disconnected without using DEVICES API. I just don’t want to implement a scheduled job in my third party in order to determine if a device got disconnected for some reason (WIFI failed, power supply failed or something else).
I’ve been searching in the documentation for some kind of hooks that I can define for my devices and every time an event (connected/disconnected) occur, I can handle it on my own endpoint instead of constantly pinging the device through its REST API.
Hi @peepnee, at this moment you can easily do that with the node-red plugin. There is an event that is raised when the device is connected/disconnected, and can be used to call an endpoint easily, i.e., your own endpoint. Moreover, if you can open a websocket against thinger.io in your host, you can also read such event (for any device). Let me know if it is possible and I will tell you how.
With an ESP8266, you can IMHO just check with millis() how long a thinger handle() takes.
It should run usually under 50mS, even with a lot of stuff to transmit.
If it takes up to 12 seconds, you are (temporarily) disconnected from the Thinger server (for several reasons, which includes disorders from the ISP provider and upstream landscape as well).
I have a number of devices hosted on thinger.io
Except for that, I also have an endpoint (on my 3rd party service) which expects a device id and event type (connected/disconnected). I am looking for a centralized mechanism which keeps a track of all my devices and once I have any of them connected/disconnected it fires up an event and sends a request to my 3rd party service.