How to implement collaborative writing?

I figured out how to implement collaborative editing in mt project … finally. What helped me a lot was reading EloquentJavascript (http://eloquentjavascript.net/) Chapter 21. Once you understand that chapter, you will also understand the implementation in collab demo.

But its a tough read. In my case I had to start from chapter 1 and finish the whole book to get a good grasp of the code. It took me around 45 days of 3-4 hours a day to do that. There are a ton of useful exercises which will help to sharepen your JS sword :slight_smile: And its fun and challenging for beginners.

Things that you can do are -

  1. Change the authors router and use express instead.
  2. Use websockets instead of long polling. This is actually surprisingly easy with socket.io.
  3. Save the changes into a database. I used mongodb using mongoose.

Alright, hope that helps. There is no easy to road to code lol, eloquentJS is hands down the best book available to learn basic JS and learning Chapter 21 in that will help in implementation of collab.

PS: If anyone want me share the Chapter 21 project-code that is modified to use express, mongodb and socket.io … do reply here. I will find some time to save it in github and post a link here :slight_smile: I am not in a position to share the collab code with that implementation as I will have to discuss with my team for the same.

Peace

1 Like