HI, I’m running my core off solar and batteries and periodically transferring data to and from my REST API in the Azure cloud.
My core mostly runs with wifi turned off to keep power usage low, and if its sensors detect an event, or a certain time has elapsed it connects to WiFi and HTTP POSTs some sensor values to my WebApi REST service in azure and also receives some configuration data in the HTTP response like “keep WiFi on so I can OTA flash some new firmware”.
I’m currently using the HTTPClient library on the core, but I’m finding it cumbersome and unreliable. I wonder if it might be more elegant if I rewrite my spark app using Spark.publish() and Spark.function() and use SignalR on the server to subscribe to the updates, but will this work on a core that spends most of its time disconnected from the spark cloud?
E.g. If I connect to the spark cloud and Spark.publish() some values and turn WiFi back off a few seconds later will this reset the web socket each time? E.g. Would the server have to be constantly polling, trying to subscribe to the core waiting for it to come online.
The same goes for sending data to my core. Can my cloud server call a Spark.Function() while my core is offline and expect the core to process the request automatically the next time it connects to the cloud?