Comments (6)
The TL;DR of how the http2/3 negotiation works is covered here:
https://github.com/GoogleChromeLabs/cronet-sample/blob/master/android/app/src/main/java/com/google/samples/cronet_sample/CronetApplication.java#L77. If you enable the on-disk cache this should only affect the very first few requests to a server, subsequent connections will respect the alt-svc signal and use QUIC.
As for protocols configuration in OkHttp (https://square.github.io/okhttp/4.x/okhttp/okhttp3/-ok-http-client/-builder/protocols/), this library bypasses the config and setting it has no effect.
Yes, I tried that. I realized my OkHttp config was missing QUIC protocol, by default is not enabled.
Which Cronet version are you using? This suggests an old one, as the default was changed in mid-2020: https://crrev.com/c/2168553
from cronet-transport-for-okhttp.
from cronet-transport-for-okhttp.
Yes, I tried that. I realized my OkHttp config was missing QUIC protocol, by default is not enabled.
#23
from cronet-transport-for-okhttp.
but OkHttp config has no effect on Cronet.
from cronet-transport-for-okhttp.
but OkHttp config has no effect on Cronet.
It does.
* QUIC is not natively supported by OkHttp, but provided to allow a theoretical interceptor that
* provides support.
from cronet-transport-for-okhttp.
The TL;DR of how the http2/3 negotiation works is covered here: https://github.com/GoogleChromeLabs/cronet-sample/blob/master/android/app/src/main/java/com/google/samples/cronet_sample/CronetApplication.java#L77. If you enable the on-disk cache this should only affect the very first few requests to a server, subsequent connections will respect the alt-svc signal and use QUIC.
As for protocols configuration in OkHttp (https://square.github.io/okhttp/4.x/okhttp/okhttp3/-ok-http-client/-builder/protocols/), this library bypasses the config and setting it has no effect.
Yes, I tried that. I realized my OkHttp config was missing QUIC protocol, by default is not enabled.
Which Cronet version are you using? This suggests an old one, as the default was changed in mid-2020: https://crrev.com/c/2168553
Thanks for your help!
implementation 'com.google.net.cronet:cronet-okhttp:0.1.0'
implementation 'com.google.android.gms:play-services-cronet:18.0.1'
Seems like you are right, I just removed the protocols I've defined on OkHttpBuilder, and requests are being resolved through QUIC. Not sure what configuration I had yesterday. My guess is that the first requests were resolved with HTTP2 as you pointed out (the one I was debugging).
// Cronet tries to use both protocols and it's nondeterministic which
// one will be used for the first few requests. As soon as Cronet is aware that
// a server supports QUIC, it will always attempt to use it first
from cronet-transport-for-okhttp.
Related Issues (20)
- adding it as an OkHttp interceptor, breaks okhttp3.Authenticator HOT 3
- java.lang.IllegalStateException: There is no read or rewind or length check in progress CronetUploadDataStream HOT 5
- Could not find VERSION HOT 3
- ByteArrayOutputStream size cant be negative HOT 1
- Cronet with Retrofit is crashing due to file-descriptor leaks HOT 4
- Can you upgrade to Okhttp 4? HOT 1
- Consider removing the Guava dependency
- Add a parallel version using android.net.http.HttpEngine
- Option for symbolicated traces HOT 1
- Occasional exceptions occur when sending network requests
- Q: IPC call when using Play Services Cronet provider? HOT 2
- ANRs when loading Cronet Provider HOT 1
- Contribution instructions HOT 2
- setURLStreamHandlerFactory is incompatible with Firebase HOT 3
- Samples should be a working gradle project HOT 1
- After use this core, on firebase monitor dashboard, network request spend more time ...
- Secure DNS support
- How to use cronet-okhttp instead of okhttp as the client request library in spring boot?
- Potential incompatiblity with apollographql/apollo-kotlin.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cronet-transport-for-okhttp.