In answer to your first set of questions, ajax_response() waited to see if anything would show up in the response bucket that needed to be sent to the client. Once something showed up, it was send down the pipe to the client, and the connection was closed. The client would then reopen the connection the ajax_response to see if anything else was on the server that needed to be processed on the client side.

But, that was an inefficient implementation. I would suggest that the newer implementation I posted this morning be used instead. I'm sure that it can still be improved upon, but it is better (for webware's threads) than the older implementation used in the AjaxSuggest example page.

In your previous mail, you explain that the client wait for some amount of time. Wait for what?

In the newer implementation, the client waits so as not to hammer the server with requests as fast as possible. If that were allowed, it would amount to the site developer willingly subjecting themselves to a DDOS. The client timeout allows the servers some time between requests. Essentially, the client wakes up every few seconds and asks the server if any new data is available. The server then responds immediately. If there was something to give to the client, then that is sent back. If there is nothing to give back to the client, nothing is send back besides the number of seconds for the client to wait until it asks the server for results again.

Check out the code: wiki.w4py.org/ajax_in_webware.html.

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

Reply via email to