Efficient communication with client side

Hi,

i’m trying to write a custom component. The component displays a large set of information, organized in a tree. Occasionally, i will make changes to this tree.
What i do not want to do on client side is, to run everytime a state change occurs through the whole tree and try to guess what changed (or rebuild everything from the ground up).
Does the SharedState communication mechanism provide precise information about what (or where something) changed?
If not, how can i accomblish that? Using the SharedState as a message queue does not work, since after a reload of the webpage the current state of the component must be recovered from the provided information of the shared state.

The only solution i current can think of, is to have the whole tree whin the state and to provide an “updated” queue with uiid’s of the tree elements that have changed. Then the client can specifically process all uiid’s that are contained in the queue. while it can recover on reload using the whole tree that is contained in the shared state.
However, my concern is, that then the communication is very inefficient since the state always contains the whole tree.

Best regards
h r

The shared state mechanism does not currently support sending only diffs of, say, collections. In cases like yours it might be preferable to use RPC methods instead of shared state to communicate changes.

Just for summary. The solution looks like this now:

  • Have an RPC call (client to server) to request the initial (current - in case of a reload) state on the client side
  • Then use RPC calls from server to client to push the
    • initial state on request and
    • occuring diffs to the client side
  • On server side, update the current state with the diffs - in case of an unexpected reload

That’s it.