How to do a comet long pulling with ActionScript3?

Posted by Victor Lin on Stack Overflow See other posts from Stack Overflow or by Victor Lin
Published on 2010-06-01T18:40:42Z Indexed on 2010/06/01 18:43 UTC
Read the original article Hit count: 294

Filed under:
|
|
|
|

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.

© Stack Overflow or respective owner

Related posts about AJAX

Related posts about flex