Which libgdx backends honor HttpRequest timeout and cancellation?
0 reputation · 10 Mar 2020, 14:21 UTC
Cross-platform HTTP timeout and cancellation in libgdx
I am evaluating libgdx’s HTTP abstraction for a cross-platform project targeting Desktop, Android, and HTML5. The goal is to enforce a request deadline and abort in-flight requests when the user navigates away, without leaving sockets or XHR handles pending.
libgdx exposes HttpRequest.setTimeout and HttpRequest.setCancel, but whether those calls stop the underlying network operation appears to depend on the backend. Desktop may interrupt only after blocked I/O completes, Android may wait for buffer drains, and HTML5 XHR abort may not invoke the response listener. Documentation does not state whether timeout and cancellation propagate consistently across all supported backends.
Because no built-in callback confirms that the network layer has fully stopped, I need to know which platforms require custom tracking or platform-specific code.
- Does
setTimeoutreliably triggerHttpResponseListeneron Desktop, Android, and HTML5? - After calling
setCancel(true), which backends guarantee that the underlying connection is closed? - Should applications implement platform-specific fallback logic to confirm connection teardown?