Ti.Network.HTTPClient: abort() vs timeout for request termination
0 reputation · 17 Sept 2024, 02:40 UTC
When managing long-running network requests in Appcelerator Titanium, there is a trade-off between using the timeout property and the abort() method to handle unresponsive servers or user-initiated cancellations.
The timeout property ensures a request fails automatically after a set duration, typically triggering the onerror callback. In contrast, abort() allows for immediate termination of a pending request without waiting for the timeout threshold to be reached.
The uncertainty lies in the consistency of callback execution across iOS and Android builds. It is unclear if calling abort() synchronously triggers the onerror callback with a specific error code, or if it simply halts the request without notifying the application state.
- Does
abort()consistently trigger theonerrorcallback across both platforms? - What is the specific error payload delivered when a request is aborted versus when it hits a timeout?