Receiving Variable Updates through Subscribe

I would find it really useful to be notified of variable changes via the subscribe mechanism.

Currently, if I want to share a variable, and know when it’s updated I need to poll your servers, which seems wasteful (and really lossy).

Instead, I’ve been publishing variables as events. This works reasonably well, but includes some work arounds. For example, I have added a ‘refresh’ method to each device so that my client software can ask for events to be republished when it starts up.

It would also be useful to clarify the exact semantics for variables. Are they checked for changes and (potentially) republished on every loop? Or just… every once in a while?

Variable values are pulled on request. If no-one’s interested in a value then there is no communication overhead.

For “push” style notifications, the Publish/Subscribe mechanism is a better fit.

Ah, you are saying they are never communicated until someone asks.

I was assuming they were being communicated up to your cloud every so often, then served from there upon request.

The current semantics make sense then, if less convenient than I had hoped.

You could make a “variables updated event” which gets published if one of your variables changes. The subscribed applications can then request your variable accordingly. This way you have the benefits of variables, with the push notification style of SSEs.

1 Like

^ I was thinking exactly that, but didn’t write it down! Thanks for picking that up! :smile:

1 Like