Reputation: 37
Does okhttp support connection pooling for http2 client ? The offifical doc https://square.github.io/okhttp/ says this "Connection pooling reduces request latency (if HTTP/2 isn’t available)".
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 ?
Upvotes: 3
Views: 629
Reputation: 40593
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 ?
Not currently.
What is the default value for max concurrent streams sent by okhttp http2 client ?
This is honored.
What happens when receiver sends refused stream error when max concurrent streams threshold is met ? Is it retried or request fails ?
OkHttp will fail the request all the way to the application. You shouldn’t expect to see this though, because OkHttp honors the max concurrent stream limit.
Note that connection creation is racy. This limit may only become known to OkHttp after it has created multiple streams. In such cases the server is supposed to permit these streams.
Upvotes: 2