Request timeout using cordova-plugin-advanced-http

Viewed 1001

I am using the advanced plugin to make calls to a legacy api that can’t implement a cors policy. My problem is that even if i set a timeout the request doesn’t seem to respect that number and throws lots of errors of connection timeout after 10000ms and other errors, like this:

status:-2,error:TLS connection could not be established: javax.net.ssl.SSLException: Read error: ssl=0x752c6976c8: I/O error during system call

status:-3,error:Host could not be resolved: java.net.UnknownHostException: Unable to resolve host

status:-4,error:Request timed out: java.net.SocketTimeoutException: failed to connect to ... after 10000ms

Did any one experienced this, and how did you mitigated the problem?

Here is my code:

constructor(private nHttp: HTTP) { }
get(url, customParameters, customHeaders) {
    this.nHttp.setRequestTimeout(30);
    return this.nHttp.get(url, customParameters, customHeaders);
}
0 Answers
Related