The approach to comets
Teehoo, if you want to use a working method, then what you suggested will be fine, especially if it is only for a school project.
If you want something like Facebook does, you should look at commet's HTTP connections. This is very smart. I remember when I first read about it, I thought it was brilliant. It provides fast updates and almost eliminates AJAX dependency by constantly polling new messages because you are constantly opening your connection to the web server.
Take a look at the comet http connections (but donβt look at the comet chat application, they are a company trying to sell a product similar to the facebook chat application and not what you want. Although they have implemented a comet method).
Comet Chat #
http://en.wikipedia.org/wiki/Comet_(programming) )
Then read the following:
http://www.zeitoun.net/articles/comet_and_php/start
But anyway, what you suggested is suitable for a school project.
Layke source share