Android WebView XMLHttpRequest Keepalive

when creating XMLHttpRequests in Android WebView, no keepalive connections are used, as it seems.

My desktop browsers use keepalive when requests are often executed (for example, XMLHttpRequests triggered in the onload event on the page are queued for the page load request).

Does anyone know what keepalive connection requirements are (timeouts, headers ..)?

Thank you very much!

+4
source share
1 answer

What you want to do is use HTTPUrlConnection http://developer.android.com/reference/java/net/HttpURLConnection.html

and install Keep-Alive as follows:

connection.setRequestProperty("Connection", "Keep-Alive"); 

This gives you a permanent URL connection. You will then use input and output streams to read and write your data to and from the server.

0
source

All Articles