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.

相关推荐
wljt12 分钟前
HTTP和openFeign
网络·网络协议·http
汤愈韬7 小时前
ACL概述、ACL原理、基本ACL应用及配置
网络·网络协议·网络安全
码刘的极客手记11 小时前
VCAP4-DCA Beta 考试体验分享与 esxcli 自动化实战(第二、三部分)
网络·esxi·vmware·虚拟机
朝风工作室12 小时前
开源一款轻量级跨网段 IPC 设备发现与网络配置工具
网络·开源
Qaz5556669112 小时前
透明DNS选路实验
网络
haluhalu.13 小时前
Linux网络编程------网络基础
网络·网络协议
坐怀不乱杯魂13 小时前
Linux网络 - HTTP协议
网络·网络协议·http
ipooipoo118814 小时前
动态住宅IP的定义、核心优势与技术场景应用
网络·网络协议·tcp/ip
祁鱼鱼鱼鱼鱼15 小时前
Keepalived实验环境设定
linux·服务器·网络
滴水之功15 小时前
OpenWrt的WAN和LAN的切换
linux·网络·openwrt