Internet button store button clicks when offline

photon
Tags: #<Tag:0x00007fe21f388138>

#1

I have an Internet button sending events to the cloud for each button click, and it will connect to wifi with weak signal. I’m wondering if there is a way to store button clicks on the photon when the photon is disconnected, so the events can be automatically send when the button got reconnected


#2

Sure there is, you just need to ensure your code keeps running while disconnected by means of SYSTEM_THREAD(ENABLED).


#3

Would also require the events to be queued until the internet/cloud connection was restored. Depending upon the event message and the number of messages when disconnected you could use the RK library- sendqueueasync (apologies - can’t remember the name but if you search for RK in libraries you will see it.)