1

I have a simple php page that displays data from a mysql database. I want it to update itself automatically when data gets changed on the server. (I don't want to update the page periodically at fix time intervals.) I guess I need the technology behind FB chat box or omegle. But I don't know how to implement it on php and mysql. I would be grateful if you could help me. Thanks.

0

2 Answers 2

1

You would need to look into WebSockets or a Comet server (which uses long-polling techniques) to accomplish a push system. Alternatively, instead of using push-like notification, you could make frequent polls to the server with nothing more than a request identifier and a timestamp, let the server decide if there is anything new since the last poll, and serve up the data if there is.

1
  • @akopacsi: You'd have to have a server that supports either WebSockets or Comet, there isn't any way around that. Otherwise you'd have to do it the other way I mentioned and just poll frequently. Though that solution might not make your shared hosting provider very happy if you had a lot of traffic.
    – WWW
    Apr 6, 2012 at 19:18
1

you can implement Comet technology which is opposite of Ajax. JavaScript Dojo Toolkit can be useful to handle this method well.

Dojo WebSocket
http://dojotoolkit.org/features/1.6/dojo-websocket
http://cometd.org/

"Comet is a web application model in which a long-held HTTP request allows a web server to push data to a browser, without the browser explicitly requesting it."

http://en.wikipedia.org/wiki/Comet_(programming))

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.