Events for Cores online / offline?

hi guys,

1: Is there any possible to fire a Offline-Event from Spark Server when the the Core catch a offline ?

2: How to publish the event inside the code when the Core in case of offline, the event will be lost or send until it is online?

3: On the other hand, For the Server sent events(SSEs), will also face to the same problem,
event from server should be cached on the cloud side? and send when the cores being online?

4: Suppose, there are lots of Cores in a system ,then, it will have a platform to monitor the real time staus(offline/online) of those Cores, if one Core got offline ,system will give an Alarm out to the Managers. then how to implement it, we need make a backend job to loop call api to fetch the Cores’s status continually?

thanks your reading…

Hi @yuanetking,

Good question! I’ve been thinking about this a bit lately.

1.) I’ve been thinking about adding this, what does everybody think?

2.) The core can’t send events when it’s offline, I believe they’re simply dropped in the meantime.

3.) The publish function has a ttl param that is meant to represent how long the event will ‘live’ on the server before it’ll be discarded, we don’t use it yet, but we will for queuing / caching old events.

4.) Totally! I think a system supported “online/offline” state event might be useful. The online part is easy to do in your firmware, but the offline part would need to be server side. I think I’d want to do both server side for consistency.


1 Like

hi @David , thanks your reply, and Sorry for my english :smile:

Maybe one thing didnt consider,Suppose, If one core is calling “Spark.publish()” but the current core is offline , then the event will not be cached into the Spark Cloud, the event will be lost, So , the locally firmware event cache is also needed, i think.

ttl will not be reliable , cos, any preset of reserving time may not meet the customer‘s requirment sometimes, it is unpredictable.

Adding the online/offline mechnism will bring more complex to the system. The reason i like Spark is because that we have the same idea, See The blog from @zach , But , I think of the key feature of the Distributed OS will be the Online/Offline event mechnism, as the network enviroment will be unpredictable (This is differ to the traditional OS like, windows, etc)

BTW, did u face to the problem about how to Identify Offline Event (hardware could not do anything when it got offline, So it will not be identified immediatly by Cloud Side )? Normally, Identified it by monitor the heardbeat. , but it will bring us scores of seconds time delay… In my previous distributed System , i used JMS(ActiveMQ) implementation(0 times delay) , but i am not exactlly know how they did . maybe you can refer to it .


A quick response to an API request for the connected state would be nearly as valuable as an event.

This functionality is important for power consumption issues as well as others…

The status of a core can be polled, when it’s up, an app can pull data or send control messages then let the core power down. the quicker the response to the online condition the longer the battery life.

For server side applications, an event (web hook) would work nicely. For other applications, not server based, a polling API would be best.

1 Like

I got a nice reply on a different thread related to this one. I’m told if we signal disconnect from the core, the response will be quick on the device status. The problem is that when a core just looses connection, like power being cut, it never tells the server and a long timeout process happens when we do a request.

This should not be a problem for cores that are being put to sleep as they do signal the server…

Am I right?