title: What is the modern programming standard for synchronizing data between a web service and a client?
body: <p>The question is a little general, so to help narrow the focus, I'll share my current setup that is motivating this question. I have a LAMP web service running a RESTful API. We have two client implementations: one browser-based javascript client (local storage store) and one iOS-based client (core data store). Obviously these two clients store data very differently, but the data itself needs to be kept in two-way sync with the remote server as often as possible.</p>
  
  <p>Currently, our "sync" process is a little dumb (as in, non-smart). Conceptually, it looks like:</p>
  
  <ul>
  <li>Client periodically asks the server for ALL of the most-recent data.</li>
  <li>Server sends down the remote data, which overwrites the current set of local data in the client's store.</li>
  <li>Any local creates/updates/deletes after this point are treated as gold, and immediately sent to the server.</li>
  </ul>
  
  <p>The data itself is stored relationally, and updated occasionally by client users. The clients in my specific case don't care too much about the relationships themselves (which is why we can get away with local storage in the browser client for now).</p>
  
  <p>Obviously this isn't true synchronization. I want to move to a system where, conceptually, a "diff" of the most recent changes are sent to the server periodically, and the server sends back a "diff" of the most recent changes it knows about. It seems very difficult to get to this point, but maybe I just don't understand the problem very well.</p>
  
  <p><a href="https://en.wikipedia.org/wiki/Representational_state_transfer" rel="nofollow">REST</a> feels like a good start, but REST only talks about the way two data stores talk to each other, not how the data itself is synchronized between them. (This sync process is left up to the implementer of each store.) What is the best way to implement this process? Is there a modern set of programming design patterns that apply to inform a specific solution to this problem? I'm mostly interested in a general (technology agnostic) approach if possible... but specific frameworks would be useful to look at too, if they exist.</p>