Posted onEdited onInOKHttpViews: Disqus: Symbols count in article: 879Reading time ≈2 mins.
Intro OKHttp
這篇簡介OKHttp。
Overview
1 2 3 4 5 6 7 8 9
OkHttp is an HTTP client that’s efficient by default:
1.HTTP/2 support allows all requests to the same host to share a socket. 2.Connection pooling reduces request latency (if HTTP/2 isn’t available). 3.Transparent GZIP shrinks download sizes. 4.Response caching avoids the network completely for repeat requests.
Using OkHttp is easy. Its request/response API is designed with fluent builders and immutability. It supports both synchronous blocking calls and async calls with callbacks.
Requirements
1 2 3 4 5 6 7 8
OkHttp works on Android 5.0+ (API level 21+) and Java 8+.
OkHttp depends on Okio for high-performance I/O and the Kotlin standard library. Both are small libraries with strong backward-compatibility.
We highly recommend you keep OkHttp up-to-date. As with auto-updating web browsers, staying current with HTTPS clients is an important defense against potential security problems. We track the dynamic TLS ecosystem and adjust OkHttp to improve connectivity and security.