How to program a Collaborative real-time web app?

I was wondering if anyone had any good starting points for making a web based app that had Collaborative real-time editing.

The best way I can think of would be to write it with php, mysql and ajax. Where if you edit a block of information in a textbox form, I would then use javascript onBlur or onChange to send an ajax request that then sends a request to a php page that processes the new data and inserts it into mysql.

But how do I get the new information to update on someone else’s browser? I could use javascript set_interval to reupdate the textbox every couple of seconds, but that sounds kind of wasteful?

Is there a better way? What else should I be thinking about? I would love to hear some ideas.

Thanks Eastcoast for the response, I have to be honest out of my own ignorance and amatuerness :slight_smile: I really did not understand anything you said. Anyway you can dumb it down for me? What is long polling, non-blocking system , etc.

Thanks, I am still just learning all this stuff and have had no formal training.

You might want to consider long polling to reduce the polling frequency substantially (however if you do this, then due to the extended wait per connection, you’re better off having your server side logic using a non-blocking system such as node.js)

Also worth looking at http://github.com/gimite/web-socket-js as a possible way of using socket communications in browsers that don’t support web sockets (most of them)

But then I wouldn’t be able to watch youtube videos if everyone was shouting at me?
My curiosity really got started the other day when I was using google docs and so was a co worker and as she updated her doc, I was able to see the changes as well. I thought that was pretty cool and being curious thought i’d investigate.

Collaborative, yes…real time??? Why?

Sit in the same room if you want real time and have a policy of shouting changes a loud so everyone hears. :stuck_out_tongue:

Kidding, but what many remote teams do is use SVN and a hook to notify each member via MSN (or similar) when a commit has been made to the repo. That way you can instantly update your codebase and see changes made in almost real time.

Polling a central server and updating your local copy automatically without approval would be disasterous, IMO.

Cheers,
Alex