Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Real time collaborative editing - how does it work?

I'm writing an application in which I'd like to have near real time collaborative editing features for documents (Very similar to Google Documents style editing).

I'm aware of how to keep track of cursor position, that's simple. Just poll the server ever half second or second with the current user id, filename, line number and row number which can be stored in a database, and the return value of this polling request is the position of other user's cursors.

What I don't know how to do is update the document in such a way that it won't throw your cursor off and force a full reload as that would be far to slow for my purposes.

This really only has to work in Google Chrome, preferably Firefox as well. I don't need to support any other browser.

like image 615
Brandon Wamboldt Avatar asked Feb 23 '11 03:02

Brandon Wamboldt


People also ask

How does Google Docs real time collaboration work?

In Google Docs, Sheets, Slides, Forms, and Google Sites, you can work together in the same document in real time. Commenting on any file brings a conversation into context so you avoid back-and-forth email and lost time. Just click New and select one of the file types below.

What does collaborating in real time mean?

Real-time collaboration is just that—people working together at the same time even if they're in different places. And the online collaboration tools available are just as varied as the types of collaboration they enable. For example, desktop sharing.

How does live editing work?

Live video editing is where there are various cameras at various angles and position, capturing single or multiple subjects and the footage is routed through a vision mixing device and edited and transmitted in real-time.


1 Answers

The algorithm used behind the scenes for merging collaborative edits from multiple peers is called operational transformation. It's not trivial to implement though.

See also this question for useful links.

like image 168
Gintautas Miliauskas Avatar answered Oct 02 '22 13:10

Gintautas Miliauskas