I've been thinking about how to make a real-time web application using nodejs/socket.io/mongodb. The idea is pretty similar to google docs, where objects edited on a page are emitted and rerendered on all client browsers.
What is the best way to go about doing this? From what I've read I can think of 3 ways:
Add a 'listener' to mongodb collections, rerender parts of page whenever changes are made to collection (cons: slow?)
Retrieve mongodb data into json file, use fs to edit, save to mongodb and delete json when done (cons: cumbersome to have extra layer between database and actual app)
Rerender without storing, save only after all changes have been made (cons: files probably not rendered correctly in all browsers)
Is there a better way to achieve this? (How does google docs work anyway?) Would really appreciate any help anyone can offer!
We built a real-time app last year, basically a tool for authors to work on the same page where they could add/remove/edit elements (text, images, videos, etc.)
What we used were:
And honestly, it's pretty awesome how fast it is.