okhttp 是否支持 http2 客户端的连接池? 官方文档https://square.github.io/okhttp/说这个 “连接池减少了请求延迟(如果 HTTP/2 不可用)”。
okhttp 是否有任何方法可以根据 rfc https://www.rfc-editor.org/rfc/rfc7540#section-5.1.2 配置连接上允许的最大并发流? okhttp http2 客户端发送的最大并发流的默认值是多少?当达到最大并发流阈值时,接收方发送拒绝流错误时会发生什么?是重试还是请求失败?
最佳答案
Does okhttp has any way to configure the max concurrent streams allowed on a connection as per rfc https://www.rfc-editor.org/rfc/rfc7540#section-5.1.2 ?
目前没有。
What is the default value for max concurrent streams sent by okhttp http2 client ?
这是荣幸。
What happens when receiver sends refused stream error when max concurrent streams threshold is met ? Is it retried or request fails ?
OkHttp 将使请求一直失败到应用程序。不过,您不应该期望看到这一点,因为 OkHttp 遵守最大并发流限制。
请注意,连接创建很活跃。这个限制可能只有在 OkHttp 创建了多个流之后才知道。在这种情况下,服务器应该允许这些流。
关于okhttp 支持 http2 中的连接池,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62529900/