There's a great article here that describes how OT and other synchronization algorithms work (OT is event passing): https://neil.fraser.name/writing/sync/
Now, synchronizing two clients is going to be more tricky. The diff algorithm works on the virtual DOM which is the result of an arbitrary javascript execution.
So while it's certainly possible to synchronize and merge the virtual DOM. You'll need to also feed this result back to the javascript program that generates this virtual DOM. The next time you call render, it should return the new merged virtual DOM.
This would be a pretty exciting thing to be able to do, i'd love to see a demo :)
Alternatively, the HTML needs to be converted client-side on the fly to something like JSONML http://www.jsonml.org/ Would that be feasible from a performance perspective?
https://code.google.com/p/google-diff-match-patch/
Diff match patch is not necessarily easier than OT.
OT is the technique used for collaborative editing, etherpad-style. Current implementations don’t work with conventional DOM’s: Etherpad has its own model of plain text with an additional ’attribute pool’. Libraries like http://sharejs.org/ only know to deal with plain text and JSON.
I would love if I could implement a collaborative editor that hooks into an existing HTML element on the page, in the way contentEditable allows for in single-user apps.
cf https://github.com/share/ShareJS/issues/1