Hi folks,
In the old AngularJs dashboard there was a mechanism called msg replay, which meant that the last input message was send again to the client side widget (e.g. when the browser page was refreshed). That way you could reconfigure your widget again, to match the last state stored in that last input message.
While that sounded at first a very brilliant idea, it resulted in a tremendous headache for ui node developers. For the simple reason that the last message only contains a small fraction of the widget full state. Let's explain this by a hypothetical button example:
- Message is injected to change the button label.
- Message is injected to change the button color.
- The browser page is refreshed.
- The last messages is resend, so you set the correct button color. However you don't have the correct button label, because the last message contains only a part of the state (i.e. the last message only the color, but not the label).
Thorsten had solved that in Flexdash, by having messages updating a server-side state and sending the delta state to the clients (to update the client-side state to keep it in sync with the server-side state). Same hypothetical button example:
- Message is injected to change the button label.
- The server-side state is updated with the new label and the new label is send to the clients, which update their client-side state with the new label.
- Message is injected to change the button color.
- The server-side state is updated with the new color, and the new color is send to the clients, which update their client-side state with the new color. Both server-side and client-side states are in sync and contain the FULL state.
- The browser page is refreshed.
- The server-side is resend, so the client-side state is correctly updated with both the new label and the new color.
For my old AngularJs ui-svg node it was the worst. For example in a floorplan you visualize a lot of devices, so a lot of state updates are required. Users had to find their own workarounds, e.g. by replaying a queue of N messages. But that is totally not waterproof, because:
- If N is not large enough, then you loose old state updates.
- The queue contains lot of messages overriding each other values over time (e.g. color red -> color green -> color red -> color green -> ...).
- Very inefficient to replay lots of old message, containing most of the time obsolete state.
In an attempt to avoid a new message replay mechanism in the new dashboard, I have at the time being tried to explain this problem in this issue. However the message based approach has been reintroduced again, so unfortunately I am completely stuck again.
So I starting rereading the documentation again, to see if there is a way to solve my issue. But not sure how I can workaround it when reading this part of the documentation:
I think I have overlooked something. Because the statement in most cases a widget only needs reference to the last message only makes sense when that last message contains the full state. I read somewhere in the documentation that the (recently introduced) dynamic properties are being merged automatically into the static properties from the config screen. So perhaps that is a new dashboard change to improve the message replay mechanism? Perhaps the keyword "message" in the client-side context is referring to messages from server to client, and not the input messages of the ui node? No idea...
Would appreciate a lot if somebody could enlighten me! Because I don't see the overal picture anymore.
Thanks!!
Bart