user490215
user490215

Reputation:

How to update a webpage (only) when something changed on the server side

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.

Upvotes: 1

Views: 213

Answers (2)

Ram
Ram

Reputation: 144689

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))

Upvotes: 1

WWW
WWW

Reputation: 9860

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.

Upvotes: 1

Related Questions