HTTPClient Timeout Just delays the connection execution
I have been using the Ti.Network.HTTPClinet in an iPhone app and it seems that when I use setTimeout(5000) it will delay the post from hitting the server for 5 seconds. Is this how the timeout should be working? It seems to be more of a delay then a timeout setting.
Thanks
2 Answers
-
Thomas
Yes, setTimeout executes a code snippet or a function after specified delay. Hence, what you are observing is expected behaviour.
I think what you are really looking for is setInterval:
setInterval takes 2 arguments: function and timeout in milliseconds for how often the function should be executed until cancelled and returns a timer handle that can be used to cancel a timer with clearInterval.
See Titanium's built-in timers for this extract.
-
Thanks for the response Hal. I understand the setTimeout / setIntraval functions. I am actually referring to the HTTPClient setTimeout as outlined in the
Mobile API Docs.