How to do a comet long pulling with ActionScript3?
- by Victor Lin
I want to load data from my web server, I want it be the AJAX/Comet way, my web-server long holds the request, response it until something happened. Thus, I wrote some as3 code like this:
private function load(): void {
var request:URLRequest = new URLRequest(url);
var variables:URLVariables = new URLVariables();
variables.tick = this.tick;
request.data = variables;
urlLoader = new URLLoader(request);
urlLoader.addEventListener(Event.COMPLETE, onComplete);
urlLoader.addEventListener(IOErrorEvent.IO_ERROR , onIOError);
log.info("Loading info from {0}", request.url);
}
It works, if the waiting time is short, but however, it failed with IOError 2032, seems the waiting time is out. Here is the problem, how can I do a long-polling with as3 and avoid the timeout error?
Thanks.