OkHttp - 现代应用网络的方式

官网:Overview - OkHttp

HTTP is the way modern applications network. It's how we exchange data & media. Doing HTTP efficiently makes your stuff load faster and saves bandwidth.

OkHttp is an HTTP client that's efficient by default:

  • HTTP/2 support allows all requests to the same host to share a socket.
  • Connection pooling reduces request latency (if HTTP/2 isn't available).
  • Transparent GZIP shrinks download sizes.
  • Response caching avoids the network completely for repeat requests.

OkHttp perseveres when the network is troublesome: it will silently recover from common connection problems. If your service has multiple IP addresses, OkHttp will attempt alternate addresses if the first connect fails. This is necessary for IPv4+IPv6 and services hosted in redundant data centers. OkHttp supports modern TLS features (TLS 1.3, ALPN, certificate pinning). It can be configured to fall back for broad connectivity.

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.

相关推荐
止水编程 water_proof8 小时前
Java--HTTP(上)
网络·网络协议·http
橘子1310 小时前
Linux网络基础(一)
linux·网络·arm开发
闲人编程11 小时前
Python在网络安全中的应用:编写一个简单的端口扫描器
网络·python·web安全·硬件·端口·codecapsule·扫描器
机器学习之心14 小时前
基于双向时序卷积网络(BiTCN)与支持向量机(SVM)混合模型的时间序列预测代码Matlab源码
网络·支持向量机·matlab
止水编程 water_proof16 小时前
Java-HTTP响应以及HTTPS(下)
网络·网络协议·http
好望角雾眠16 小时前
第四阶段C#通讯开发-9:网络协议Modbus下的TCP与UDP
网络·笔记·网络协议·tcp/ip·c#·modbus
网安小白的进阶之路17 小时前
A模块 系统与网络安全 第四门课 弹性交换网络-5
网络·安全·web安全
8K超高清17 小时前
高校巡展:中国传媒大学+河北传媒学院
大数据·运维·网络·人工智能·传媒
C2H5OH66617 小时前
WebSocket-练习1
网络·websocket·网络协议
狂奔的sherry17 小时前
Socket vs WebSocket
网络·websocket·网络协议