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.

相关推荐
陌上花开缓缓归以1 小时前
linux boot 烧写纪要以及内存相关分析
linux·服务器·网络
yy_xzz1 小时前
【Linux开发】 04 Linux UDP 网络编程
linux·网络·udp
123过去1 小时前
mdb-sql使用教程
linux·网络·数据库·sql
eam0511231 小时前
HCIA复习实验
网络
瑞瑞大大1 小时前
国家“东数西算”工程八大算力枢纽节点及10个国家数据中心集群介绍
网络
belldeep2 小时前
python:Scapy 网络数据包操作库
网络·python·抓包·scapy
23.2 小时前
【分析】网络不通会显示404吗?
网络
千百元2 小时前
网络图标显示不正常
开发语言·网络·php
攻城狮在此3 小时前
ARP配置(IP与MAC地址绑定,静态绑定)
网络
吉哥机顶盒刷机3 小时前
IPTV抓包工具合集:Wireshark、parse_cap_channels_v2、IPTV全能工具箱
网络·测试工具·wireshark