[AC-1708] Http client request timeout never called when in airplane mode
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | n/a |
Status | Resolved |
Resolution | Cannot Reproduce |
Resolution Date | 2014-05-04T05:30:59.000+0000 |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | Alloy, Titanium SDK & CLI |
Labels | n/a |
Reporter | Lucas Alves |
Assignee | Ritu Agrawal |
Created | 2014-05-01T16:08:08.000+0000 |
Updated | 2016-03-08T07:38:12.000+0000 |
Description
When in airplane mode, the error callback of a request is not triggered after the pre-determined timeout.
All other network errors triggers the callback normally.
Steps to reproduce:
1) turn airplane mode on
2) Execute:
var url = "http://www.appcelerator.com";
var client = Ti.Network.createHTTPClient({
// function called when the response data is available
onload : function(e) {
Ti.API.info("Received text: " + this.responseText);
alert('success');
},
// function called when an error occurs, including a timeout
onerror : function(e) {
Ti.API.debug(e.error);
alert('error');
},
timeout : 5000 // in milliseconds
});
// Prepare the connection.
client.open("GET", url);
// Send the request.
client.send();
FYI: I was able to overcome this problem testing before sending the request if I had network available with Ti.Network.online, BUT, from I assume (if I'm wrong please forgive me) would be the correct behavior even if I don't test the network, the error callback should always be called after the pre-determined time.
I tried your test case and it displays the error alert correctly in airplane mode. I tested it on a 7.1.0 simulator as well as device. What is the behavior in case of airplane mode?
For me it didn't fire the callback. Leave it open for now, please. I''l look into it again and get back to you.
Ok, so I was able to confirm that indeed the callback is fired when testing on the device. The problem still remains in my emulator, which right now seems a lot more buggy than just that. In fact, the airplane mode doesn't seem to be doing anything at all now. I can still make requests, use the internet, etc. even if I turn off wifi. I cannot find the airplane mode on 'General settings', only when I pull the settings panel from the bottom, but switching airplane mode there does not change the icon on the menu bar. Is airplane mode supposed to behavior nicely on the emulator?
The best way to simulate airplane mode on an emulator is to turn off your machine's network connection. Callback was fired correctly when I turned off network completely. Resolving this ticket as "Cannot reproduce" but we would be happy to reopen it if you can provide a consistent set of steps to reproduce this issue.