How does Google Docs text synchronization work in Drive?

Asked

Viewed 88 times

1

So I couldn’t find this information, but I’m curious to know how it works real-time synchronization of text documents on Google Drive.

The issue is that two people can edit the file at the same time, with the changes appearing for both virtually instantly.

I really want to know how this works to see where I can implement something similar, I accept links with the explanation about it too.

I want to know, how does this synchronization work in which the two can see at the same time what is changed? What language do they use to do this? What bank do they use? What dark magic is this?

  • The theory is not complicated: take what has been modified, send it to the other person with the file open, and update their version. Nothing special in between, just Javascript, websocket. Probably not even database has (or at least it is possible to do without). No black magic.

1 answer

1


The theory is not complicated: take what has been modified, send it to the other person with the file open, and update their version. Nothing special in between, just Javascript, websocket. Probably not even database has (or at least it is possible to do without). There is no black magic, let alone something special.

In fact, the implementation of this feature is quite straightforward, being the latency (minimized with websocket), connection problems and conflicts the biggest enemies.

The most complicated part is to merge one person’s changes with another person’s changes when they change the same location or property. In this case, I believe it highlights that there was conflicting information and let the user resolve.

This conflict behavior is different from the version controls (git, svn, Hg), which first attempt to resolve the conflict (using 3-way-merge, for example) and only if it is not possible, asks the user to resolve at hand.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.