I think I understand now.
The client is polling the server for new data that could come up
because of external events.
If I understand correctly, this kind of application is useful for a
certain class of websites like chat, real time data updating (like
stock quotes), etc..
In majority of ajax applications, such polling might be useless isn't it?
Not quite useless. The reason I originally wrote AjaxPage was for a
system that can have long-running requests to the server (generating
reports). In that case, I was fighting against browser/server timeouts.
On our installation of Apache, the client/server connection would be
broken after 5 minutes. I needed a way to get around this. For a long
running request, AjaxPage works as follows:
1) Client requests a big report. This request is sent to ajax_request().
2) ajax_request() calls the appropriate functions on the server.
2a) Once the server-side function has returned, the results are sent
back down the pipe to the client...
2b) ...unless it took longer that TIMEOUT seconds to complete (the
timeout is defaulted to 100). Since, in our example, the request _did_
take a while to finish, ajax_request() puts the results into the results
bucket that ajax_response() is polling.
3) ajax_response(), which is being polled every few seconds by the
client, sees that there is something for the client in the results
bucket, grans it, and sends it to the cient.
The results sent to the client can be anything, really, but, in my
implementation, the results are eval'd on the client side as javascript.
For a particular application, one may not ever need this functionality.
Since the amount of time the client waits between polls of the sever is
set on the server, you could just set that value to a really big number,
essentially stopping the polling (see ajax_response).
--John
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Webware-discuss mailing list
Webware-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/webware-discuss