Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-11260] Android: client.setTimeout does not work.

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2012-10-29T20:28:37.000+0000
Affected Version/sRelease 2.1.2, Release 2.0.3
Fix Version/sRelease 3.1.0, 2012 Sprint 22 API, 2012 Sprint 22
ComponentsAndroid
Labelsapi, parity, qe-testadded
ReporterAmuktha Akkinepally
AssigneeHieu Pham
Created2012-10-04T22:08:24.000+0000
Updated2014-06-19T12:43:09.000+0000

Description

the timeout can be set in the below ways:
client.timeout=timeOut; 
client.setTimeout(timeOut); 
var client = Titanium.Network.createHTTPClient({timeout=timeOut});
But it only works when its set as client.timeout=timeOut;

Steps to reproduce:

In the below code If you can replace with any of the above three it should work the same but it does not.
var win = Ti.UI.createWindow({
	backgroundColor : 'pink'
});
win.open();

var postData = '{"email":"vaibhav.mundale@zeonsolutions.com","password_hash":"1234567","deviceUId":"14913af4-025c-e301-239b-1ba1-400e491f50a9","password":"1234567","store_id":"5"}';

var timeOut = 1500;
var client = Titanium.Network.createHTTPClient({timeout:timeOut});
if(Ti.Platform.osname !== 'android')
   client.tlsVersion = Titanium.Network.TLS_VERSION_1_1;
client.open('POST', 'http://173.227.201.16/BradyMobile/Login');
client.setRequestHeader("Content-Type", "text/json");
client.onload = function() 
{
    alert('Status load:' + this.status +':'+ this.responseText);
}
client.onerror = function(e) 
{
    alert('Status error:' + this.status +':'+ this.responseText);
};
client.send(postData);
1. Run this code Expected behavior: error alert pops up, timeout exception in log Actual behavior: nothing happens

Comments

  1. Ping Wang 2012-10-29

    PR: https://github.com/appcelerator/titanium_mobile/pull/3342
  2. Satyam Sekhri 2013-01-22

    Verified on: Studio: 3.0.1.201212181159 SDK: 3.1.0.v20130114171802 Android Device: LG P970 (v2.2), Samsung Galaxy Note (v2.3.6)

JSON Source