title: How to push diffs of data (possibly JSON) to a server?
body: <p>I am going to be periodically pushing a set of text-based data <strong>from a web-page to a server</strong>, probably as JSON.</p>
  
  <p>For every push, none, some or all of the data may have changed. To reduce the amount of data I have to send over the wire I would want to only send a diff of the changes in each push.</p>
  
  <p>Do you know of any pre-made solutions / tools / libraries that:</p>
  
  <ul>
  <li><strong>Dynamically build a diff of JSON as changes are made</strong> to it (to avoid storing oldJson and newJson and doing a full diff every push) written in JavaScript (i.e. for the client-side)</li>
  <li><strong>Patch an existing chunk of JSON with a JSON diff</strong> on the server side, written on any platform that isn't Java or .NET^ (needs to run on linux, Java's not an option for the env I'm in, neither is Mono).</li>
  </ul>
  
  <p>Moreover, is this even the best way of going about this particular problem? <strong>Is there a better way to push chunks of text data around?</strong></p>
  
  <p><strong>Edit:</strong> Some clarifications:</p>
  
  <ul>
  <li>The probable data stucture would be basically a fairly flat (in the sense that it's hightly connected so any links will be ID-based references not actual nested data) collection of nodes. Nodes contain a collection of trees, the leaves of these trees contain actual 'primative' data, such as numbers, strings and Ids. Most data change will be in the leaves.
  
  <ul>
  <li>Most of the leaf data will be very small (primatives or less than a paragraph of text) but some will be very long (pages of "rich" text).</li>
  </ul></li>
  <li>For the moment we can consider this strictly one-to-one, i.e. there is only one client connected (in read / write) to any particular data structure.</li>
  <li>It would be nice to keep the server as minimal as possible in terms of complexity-- the idea is to move away from having a server as much as possible. While HTML5 is still mostly unsupported I still need one to store data with though...</li>
  </ul>
  
  <p><strong><em>^</strong> That that you would expect on random shared hosting. I'm talking your good friends PHP, Python, PERL, Ruby, those fullas.</em> Or, something that could be easily installed on random shared hosting.</p>