Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-3278] HTTP Request Timeout

GitHub Issuen/a
TypeBug
PriorityTrivial
StatusClosed
ResolutionFixed
Resolution Date2011-05-17T16:35:57.000+0000
Affected Version/sn/a
Fix Version/sRelease 1.7.0, Sprint 2011-11
ComponentsiOS
Labelsios, release-1.7.0
ReporterReggie Seagraves
AssigneeJacob Relkin
Created2011-04-15T03:41:11.000+0000
Updated2011-05-17T16:35:57.000+0000

Description

Client code needs to be able to specify timeouts for HTTP Requests.

Comments

  1. kosso 2011-04-15

    Doesn't this work for you?

       
       var xhr = Titanium.Network.createHTTPClient();
       xhr.timeout = 1000000;
       
       xhr.onerror = function(e){
           Ti.API.info('IN ERROR ' + e.error);
       };
       xhr.onload = function(){
       
           Ti.API.info(this.responseText);
       };
       xhr.open('POST','http://some.url');
       
       xhr.send();
       

    Seems to be ok for me (1.7.0 and has been for a long time since 1.4ish)

    Given that it needs to be set before open() and send()

    Note use of xhr.timeout = xxxx rather than xhr.setTimout(xxxx)

  2. Jacob Relkin 2011-04-15

    @kosso,

    Does this work on iOS?

  3. Eric Merriman 2011-05-17

    This is represented in KitchenSink at Platform>XHR>setTimeout. Verified functioning as expected with SDK 1.7.0RC1 on iPhone 4 4.2.6 and android devices. Code example is: var xhr = Ti.Network.createHTTPClient(); xhr.setTimeout(30000); Closing.

JSON Source