To solve the question of how Google Docs works: Here is a Blog post by the guy who designed the syncing system of gdocs: https://neil.fraser.name/writing/sync/ The link point to a detailed writeup of a syncing system that can work in lossy enviroment like Internet.