I have looked at and now think I understand these 2 examples from the wiki:
I really want to build a fully connected dashboard for monitoring and controlling my smarthome devices from a uibuilder/bootstrap/vue set of pages. The part that I think I will have to build for myself is a robust caching capability to populate the current state of all of the switches, lights etc. when I first connect a client device to the page.
I would appreciate any suggestions on if there is an already built example that I can tweak or if I am missing any major use cases based on the following plan:
Configure Node-Red context capability to allow the global variables to be saved to disk. (I am doing this so that I can retrieve them directly if Node-Red has been restarted). (I can also imagine using something like writing the info to a file for persistent storage, but I don't see any value added by using something other than Node-Red context capability.)
Modify the function from the simple cache example to store all of the state giving messages into a global variable that is an array of those msgs].
Modify the function from the simple cache example to loop through the array of stored messages and send them to the uibuilder node individually. (I think I could have it send the array as a single msg property, but then I would have to break the array apart inside my index.js and since I already have to mess with the array for storing it inside the Node-Red function node, I figure I will keep all of the complexity there.)
Modify the function from the simple cache example to take new incoming messages and identify if they are replacements for existing cached messages and when they are update the cache appropriately.
I suspect there may be some value in replacing the array that I talk about with JSON object to store the cached msgs, and wouldn't mind feedback on that point as well.