View Full Version : Push AJAX
knightcon
05-20-2008, 07:14 AM
Does anyone know how I could setup push AJAX on a PHP/CSS/AJAX page which would allow me to send data through to the browser from the server triggering the update rather than wasting bandwidth checking for updates at regular intervals. The data on the page needs to be accurate up the the second.
AFAIK this can't be done, although it's an interesting idea. Eventually we may be at a state where the server can anticipate when a user will open the browser and request a specific page or specific data, but right now it's just a client - server methodology. You create a page request, the server sends the page, round and round we go. Ajax is no different, it just does it "in the page" so you don't have to perform a complete page request.
I see no difference in this and using setInterval in your code to perform requests every N seconds.
A1ien51
05-20-2008, 02:42 PM
Well http is not meant to really do this. Ideally you would look to a language that would allow socket connections such as flash/flex or applets.
If you want to do it through the XMLHttpRequest Object, you should look into COMET.
Eric
FJbrian
05-23-2008, 04:44 AM
have the page (OnLoad) check for updates not the server
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.