Skip to content
This repository has been archived by the owner on Dec 3, 2024. It is now read-only.

niusounds/cronet-engine

Repository files navigation

cronet-engine

Release

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.

Add dependencies

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'
}

Create the client

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()
    }
)

About

Ktor client engine using Cronet as backend.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages