Losant is a simple and powerful IoT cloud platform.
The platform provides a MQTT broker that sensor devices can connect to and report state in real time; the reported states are stored in the cloud, and can be visualized in several formats.
Recently, Losant sent me a Builder Kit which contains an ESP8266 WiFi chip on Adafruit Feather Huzzah, a TMP36 temperature sensor, and some other components.
Following the official instructions, 1.5 hours later, my room temperature shows up on a webpage.
I'm excited, and I decide to leave it running continuously so that I can monitor the activities of @TheTucsonHeat.
However, Losant platform shows the device as "offline" from time to time, and sometimes it never comes back online unless I press the hard-reset button.
This is mostly because of the bad WiFi in my apartment: 1000ms huge delay, 10% or more packet loss, etc.
Since MQTT is based on TCP, it's severely affected.
To make things worse, our WiFi connects to the Internet through two levels of Network Address Translation (NAT) gateways; it seems that the ESP8266 sometimes is unable to detect the TCP connection to Losant broker is broken, and thus does not take recovery actions.
As a computer networking student, the first thing coming through my mind is the end-to-end principle: the reliability of an application should be ensured by the end hosts, not by the network.
To test whether my temperature sensor remains connected to Losant, I should send a message to the Losant platform, and let the platform send back a reply.
And that's the idea of LosantPingPong: an end-to-end connectivity test between a connected device and the Losant platform.
LosantPingPong protocol