ShareJS – Live concurrent editing in your app
sharejs.org
sharejs.org
This is why we can't have nice things.
I got several popups (alerts) with the word Faggot in them in my browser after I let the page sit for 10 minutes.
Is there a conceptual difference? Diffs support all types of operations - insert, remove, replace. I'm really curious about realtime collaboration, but can't decide which is the right tool for the job.
DiffMatchPatch gets confused pretty easily around similar content. It uses lexical similarity to determine the patch. It often fails, and the API actually tells you that it was unable to apply a patch. For example, if you make a huge change to a file, diffMatchPatch will be unable to generate a patch file.
Operational Transform, on the other hand, uses some an ordered sync to ensure that changes are applied in a consistent way across all clients. It woudln't fail in the same way and is resilient to more kinds of changes.
If only it wasn't written in node....
For science, I ported the core operational transform algorithm code from coffeescript into C and got a ~10% reduction in code size and an 8x performance boost. The networking and database code won't translate anywhere near as well, but it may still be worth doing at some stage.
http://incubator.apache.org/wave/
The architecture for Wave is really difficult to get a handle on, though.
Relative ease of use is a major benefit of ShareJS, though I can't fully vouch for its algorithmic correctness. I've been meaning to contribute some additional tests to the project.
As I mentioned, I hope to contribute tests to show that everything's peachy. Not trying to talk trash about this great library.
For now it's Google-docs, then copy/paste, but sharing the mail on the go would be so useful.
Maybe for editing a textarea with rich formatting.
But ShareJS supports much more than that. You can sync custom objects etc. Look at their examples!