Git Product home page Git Product logo

Comments (6)

Danstahrg avatar Danstahrg commented on May 3, 2024 1

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.

ag2s20150909 avatar ag2s20150909 commented on May 3, 2024

https://developer.android.com/guide/topics/connectivity/cronet/reference/org/chromium/net/CronetEngine.Builder.html#addQuicHint(java.lang.String,%20int,%20int)

from cronet-transport-for-okhttp.

araujo-luis avatar araujo-luis commented on May 3, 2024

https://developer.android.com/guide/topics/connectivity/cronet/reference/org/chromium/net/CronetEngine.Builder.html#addQuicHint(java.lang.String,%20int,%20int)

Yes, I tried that. I realized my OkHttp config was missing QUIC protocol, by default is not enabled.
#23

from cronet-transport-for-okhttp.

ag2s20150909 avatar ag2s20150909 commented on May 3, 2024

but OkHttp config has no effect on Cronet.

from cronet-transport-for-okhttp.

araujo-luis avatar araujo-luis commented on May 3, 2024

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.

https://github.com/square/okhttp/blob/337b1b1b19a702916798096766b80e4b3700db01/okhttp/src/commonMain/kotlin/okhttp3/Protocol.kt#L77-L85

from cronet-transport-for-okhttp.

araujo-luis avatar araujo-luis commented on May 3, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.