This is cool! I've been working on something similar in Go, but I haven't spent much time on it recently. Is this a purely front-end application, or is there a server associated with it?
Thanks! My implementation is currently front-end only. Here's the code that simulates all the client/server communication: https://github.com/cricklet/blue-ot.js/blob/master/js/ot/orc... It shouldn't be too hard to take that and put it in an actual client/server architecture. The client needs to have a way to send local operations to the server (this can just be an endpoint on the server) and the server needs a way t…
Show HN: Operational transform for realtime collaborative editing in JS/Flow
11–16 of 16 posts
Re: Show HN: Operational transform for realtime collaborative editing in JS/Flow
#12The basic problem with OT (and current "real-time" collaborative editing approaches) is that they can only achieve eventual consistency. While this sounds great, eventual consistency DOES NOT mean semantic consistency. This rules it out for many applications where semantic correctness is important. Even for simple text documents you can get eventually correct but semantically incorrect results. For example, consider…
but wouldn't this be somewhat (*not 100%) mitigated with UI? (e.g. showing carret positions + time-agos of different users, asking user(s) to resolve a conflict, etc.)
Re: Show HN: Operational transform for realtime collaborative editing in JS/Flow
#13The basic problem with OT (and current "real-time" collaborative editing approaches) is that they can only achieve eventual consistency. While this sounds great, eventual consistency DOES NOT mean semantic consistency. This rules it out for many applications where semantic correctness is important. Even for simple text documents you can get eventually correct but semantically incorrect results. For example, consider…
I would expect that if an editor makes a change, their change should be preserved. There is no general case where you can decide which edit to keep, because in some cases(like the one you presented) people are editing the exact same sentence, but far more often people will not make edits to the same small part at the same time(at least in the real world). This makes OT very practical since generally the eventual cons…
I think OT and other "real-time" collaborative editors are practical if you are willing to (or your use case can) live with "silent semantic errors".
The greater the document "interconnectivity" (eg, paragraph A is semantically related to paragraph C), the greater the likelihood of having far-flung silent semantic errors.
For documents like spreadsheets this is very obvious because you start getting nonsensical results and (hopefully) errors very quickly. For Word-like documents, the errors are "silent" and thus much more insidious.
My point was that that is an element of OT which many users don't realize.
With regards to predictability, I would not call the results of OT predictable from a user's perspective. It is predictable in the narrow sense that for a sequence of arrival of operations AT THE SERVER it is predictable.
However, it is impossible for a user to predict how their local operations will interleave at the server with other users' local operations. For all practical purposes the converged result is unpredictable from the user's perspective.
The only property which one can confidently assert with OT is eventual consistency.
Re: Show HN: Operational transform for realtime collaborative editing in JS/Flow
#14The basic problem with OT (and current "real-time" collaborative editing approaches) is that they can only achieve eventual consistency. While this sounds great, eventual consistency DOES NOT mean semantic consistency. This rules it out for many applications where semantic correctness is important. Even for simple text documents you can get eventually correct but semantically incorrect results. For example, consider…
I can't think of a CRDT / anything that can handle your example... but wouldn't this be somewhat (*not 100%) mitigated with UI? (e.g. showing carret positions + time-agos of different users, asking user(s) to resolve a conflict, etc.)
Asking users to resolve a conflict is not possible, because the whole idea of OT is to have no-conflict merges and would have no idea where the conflicts are.
Re: Show HN: Operational transform for realtime collaborative editing in JS/Flow
#15The basic problem with OT (and current "real-time" collaborative editing approaches) is that they can only achieve eventual consistency. While this sounds great, eventual consistency DOES NOT mean semantic consistency. This rules it out for many applications where semantic correctness is important. Even for simple text documents you can get eventually correct but semantically incorrect results. For example, consider…
Thanks for the thoughtful post. What do you see as the next best alternative approach to OT?
Some practical solutions are that the document starts out in a 'real-time collaborative editing' phase. After this phase is over, the document moves to a 'review' phase where the document is reviewed for semantic errors and those errors are fixed using a 'non-real-time' approach.
The only way I see at this time to avoid silent semantic errors in the first place are non-real-time approaches.
The best practices here are optimistic locking/leasing of "semantically-connected regions" (could be defined as a paragraph, document, multi-docset, worksheet, slide etc.) along with semantically useful diffs (diffs that are meaningful for an end user) for conflicts.
You could say that this is the approach taken by version control systems like git, where the semantically-connected region is the File/Document.
Semantically useful diffs for anything other than text documents is a non-trivial problem in itself. But is still more tractable than avoiding or detecting silent semantic errors with OT.
Re: Show HN: Operational transform for realtime collaborative editing in JS/Flow
#16Earlier quoted context omitted.
I would expect that if an editor makes a change, their change should be preserved. There is no general case where you can decide which edit to keep, because in some cases(like the one you presented) people are editing the exact same sentence, but far more often people will not make edits to the same small part at the same time(at least in the real world). This makes OT very practical since generally the eventual cons…
It is fairly trivial to construct an example where editors are editing _different_ sentences and OT takes two locally semantically correct states and converges to a semantically incorrect (but grammatically correct) state. I think OT and other "real-time" collaborative editors are practical if you are willing to (or your use case can) live with "silent semantic errors". The greater the document "interconnectivity" (e…