

Real-Time Collaboration Issues and Solutions - ivan_burazin
https://blog.codeanywhere.com/real-time-collaboration-issues-and-solutions/

======
ggreer
Operational transformation very useful, but it has some drawbacks if you want
to do more complicated things with text. Most OT implementations can only get
one step out of sync with the server. Client complexity goes _way_ up if you
want to do more than that. Also, transformations can only be simple inserts
and deletes. These two limitations combine to make it difficult or impossible
to search-and-replace, re-indent, or sort lines alphabetically. To do
arbitrary transformations of text (or anything) collaboratively, you need
different algorithms. Neil Fraser has written extensively on this topic, and
suggests an alternative sync strategy.[1]

Disclosure: I'm one of the founders of Floobits[2]. Since native text editors
let you do all kinds of crazy stuff with text, we use an algorithm similar to
the one described by Neil Fraser.

1\.
[https://neil.fraser.name/writing/sync/](https://neil.fraser.name/writing/sync/)

2\. [https://floobits.com/](https://floobits.com/)

~~~
saurik
I have never heard of an OT implementation with the limitation you state (only
being able to keep a single difference), as OT is designed to make that easy
to solve: the client can take each new operation it is making and append it to
a "difference" buffer, and then transform the difference buffer (which moves
contents in its workin copy) by the results from the server when the server
acks it's transform. It then can immediately flush this buffer to the server
as a new synchronization request. This reuses the exact same logic as any
other transform, so it adds almost no code to the client.

As for the limitation that OT only supports inserts and deletes: OT supports
anything that can be transformed. If you build an operation "indent area" and
then provide a way to partially order that operation against all the other
operations (such as "range operation, sort by first position, reverse second,
and break ties by operation") you can transform it by moving the position
boundaries for inserts and deletes, and when it applies and itself creates a
ton of spaces in its interior, that is how it transforms the rest of the
operations in the queue. Wave had a number of interesting transforms designed
to help it edit structured documents.

------
JohnHammersley
This is a really nice explanation, thanks for taking the time to post it.
We've got our own real time collaborative editor going with code-mirror at
[https://www.overleaf.com](https://www.overleaf.com) (formerly writeLaTeX),
and have experienced many of the same issues!

What are you next plans for it? Be good to have a chat sometime in the new
year if you're interested :)

~~~
_mhr_
FYI, the image on the front-page of overleaf.com still has the writeLATEX logo
in it.

~~~
JohnHammersley
Thanks - yes, we've still got a few things to finish up on the relaunch (we
got the technical stuff out of the way first, now have things like that
screenshot to go through and update!)

