6 ms·
Hi! I want to create a web app like Google docs where multiple users can collaborate in real time to edit the document together (using a special link like gdocs
by superasn 5y ago
Hi! I want to create a web app like Google docs where multiple users can collaborate in real time to edit the document together (using a special link like gdocs generate). I want to save the docs in a MySQL db (no firebase)
My questions are:
1) Since multiple people are working together how does one manage conflicts, i.e. 2 people sending different edits simultaneously.
2) If one clients gets disconnected (4g) and then reconnects later how does it sync the changes it made during it was offline?
I recently watched this RAFT presentation (1) and I think I would need to use something like this?
What other alternatives are viable?
Also can I make it happen using just PHP, Javascript and MySQL?
Thanks
(1) http://thesecretlivesofdata.com/raft/ http://thesecretlivesofdata.com/raft/
- hammersmith 5y agoHave a look at https://m-ld.org/ https://m-ld.org/ , its a CRDT implementation that's all Javascript. it could help
- matt_oriordan 5y agoYup, and it supports Ably too, see https://js.m-ld.org/#ably-remotes https://js.m-ld.org/#ably-remotes! Matt, Ably co-founder
- superasn 5y agoLooks very promising. Thanks for sharing!
- jkarneges 5y agoI made a document editing demo here: https://github.com/fanout/editor https://github.com/fanout/editor It uses operational transformations ("OT") to manage conflicts, and it saves the data in MySQL. Technically any Django DB backend will work for storage, but the public demo instance uses MySQL. One of the reasons I made this thing was to show that realtime apps don't need to require heavy frameworks or unusual databases. And it loads super fast. I don't think you need Raft if you have a central database storing the document. You could also consider using CRDTs instead of OT, which may be more powerful but also more challenging to develop.
- AlexTDiaconu 5y agoBig question! It deserves its own blog post haha. CRDTs can be the answer. We actually wrote about them recently (https://ably.com/blog/crdts-distributed-data-consistency-challenges https://ably.com/blog/crdts-distributed-data-consistency-cha...), and there is more coming soon as our Chief Of Scientist and his team are researching CRDTs and building demos!
- born-jre 5y agohttps://en.wikipedia.org/wiki/Conflict-free_replicated_data_type https://en.wikipedia.org/wiki/Conflict-free_replicated_data_... https://en.wikipedia.org/wiki/Operational_transformation https://en.wikipedia.org/wiki/Operational_transformation ofcourse u will need websocket to sync changes.
- mathgladiator 5y agoCRDT solve a part of your problem, and an important consideration is whether or not you want off-line editing. If you don't need off-line editing, then a WebSocket can do it. I'm actually using my project to build a collaborative IDE (designer like Figma): http://www.adama-lang.org/ http://www.adama-lang.org/ I'm going to be launching it as a SaaS soon so people can spin up a new back-end without managing an infrastructure.