I want to make a persistent http connection in my android application. Since the backend responses are configured for Keep-Alive .
I would like to know how to make persistent http connections in Android in order to avoid handshake request everytime.
Set the header to include a keep-alive request.
HttpURLConnection conn = (HttpURLConnection) mURL.openConnection();
conn.setRequestProperty("Connection","Keep-Alive");
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.