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:
1) Using mongodb oplogs
Add a 'listener' to mongodb collections, rerender parts of page whenever changes are made to collection (cons: slow?)
2) Using local json
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)
3) Using purely socket.io
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!