The question is a little general, therefore, to narrow the focus, I will share my current setting, which motivates this question. I have a LAMP web service using the RESTful API. We have two client implementations: one browser based on a javascript client (local storage) and one iOS-based client (master data storage). Obviously, these two clients store data in different ways, but the data itself should be stored in two-way synchronization with the remote server as often as possible.
Currently, our “synchronous” process is a bit dumb (as in, non-smart). Conceptually, it looks like this:
- The client periodically requests a server for ALL the latest data.
- The server sends remote data that overwrites the current set of local data in the client store.
- Any local creation / update / deletion after this point is processed as gold and immediately sent to the server.
The data itself is stored relationally and periodically updated by client users. Clients in my particular case do not care too much about the relationship itself (therefore, we can leave with local storage in the browser at the moment).
Obviously, this is not true synchronization. I want to go to a system where, in fact, the diff from the latest changes is periodically sent to the server, and the server sends back the diff from the latest changes that it knows about. It seems very difficult to get to this point, but maybe I just don’t understand the problem very well.
REST feels like a good start, but REST only talks about how the two data stores talk to each other, and not how the data itself is synchronized between them. (This synchronization process is left to the developer of each store.) What is the best way to implement this process? Is there a modern set of software design patterns that are used to communicate a specific solution to this problem? I am mainly interested in the general (technological agnostic) approach, if possible ... but the specific framework would be useful to view if they exist.
source share