Best way to serialise tink_state.State and sync server with client

(Uldis Baurovskis) #1

I have a server and a client app that both use tink_state.State for state management. All good, but I need to sync state between server and client when it reconnects, best what I thought up now is to serialize server state to json and then send to client and loop through and if state object is found call state.set(value) on a client to trigger observable listeners a bit tougher will be with ObservableMap and Array but still doable. Other is to send array with actions and values, like { action: UpdateHistory, value: [] } and then implement action handler that will know what to do with that data, anyone have better suggestions or experience? (Not all props in my store are of type tink_state.State some are just ordinary objects)