Ktor engine implementation using Cronet as backend which enables HTTP/3 with ktor-client.
THIS IS NOT AN OFFICIAL IMPLEMENTATION.
Still very early stage. Currently simple GET
request is only supported.
Step1: Add https://jitpack.io
repository into settings.gradle(.kts)
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
maven { url 'https://jitpack.io' } // <- Add this
}
}
or legacy version (build.gradle)
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
Step2: Add the dependency
dependencies {
implementation 'com.github.niusounds:cronet-engine:0.0.1'
}
val client = HttpClient(
engine = Cronet.create {
context = applicationContext
config = { // this: CronetEngine.Builder
enableBrotli(true)
enableQuic(true)
}
}
)
You can pass existing CronetEngine instead.
val client = HttpClient(
engine = Cronet.create {
preconfigured = CronetEngine.Builder(applicationContext)
.enableBrotli(true)
.enableQuic(true)
.build()
}
)