I am developing complex custom components for vaadin. And have one question about server to client (component state) serialization. Is server part must send ALL component state to client. or it is allowable to send only updates of component state to client. Is it a good practice?
You don’t have to send all component state to the client, just send what is needed for rendering.
Unfortunately as it currently is doing partial variable updates to the client is kind of awkward, you will need to manually keep track of what should be updated in the next paint. But if you have lots of data you update frequently then definitely, do partial variable updates.
John is right that only visible stuff should be sent to the client. That keeps the invisible data on the safe side and it cannot be investigated with a JS debugger.
However, sometimes it makes sense to cache stuff to the client to make things faster. I created the
Widget RPC mechanism to help you with that. It implements a invocation-callback framework to simplify the on-demand transfer of data. It is still limited to the basic data types, but most that is all you need.
(Side note: Partly based on this, there are plans to create similar, but more Java-like communication API for the Vaadin core. It will most likely include some kind of generic serialization of complex Java objects.)
i now think that sometimes it is easier and logically not sent all component data that needed for render but only updates. it is allow paint only component update but not repaint all component. but you need to implement special mechanism for sending all component state to server when user refreshes page.