Kotlin Libraries
The Kotlin bindings expose Media over QUIC to Android apps and JVM-based services. Built on the same Rust core (moq-ffi) as the Python and Swift packages, wrapped with idiomatic Flow and coroutines.
Packages
dev.moq:moq
A single Kotlin Multiplatform module that publishes both JVM and Android variants under one coordinate. Consumers add dev.moq:moq:VERSION and Gradle metadata resolution picks the right artifact for their target.
Features:
- Android (arm64-v8a, armeabi-v7a, x86_64) and desktop JVM (Linux, macOS, Windows)
Flow-based async sequences with structured cancellation- Native binaries bundled via JNI (Android) / JNA (desktop JVM)
Installation
kotlin
// build.gradle.kts
dependencies {
implementation("dev.moq:moq:0.2.0")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.9.0")
}Published to Maven Central via release-kt.yml. Native binaries for all supported targets are bundled in the artifact, so no extra setup is required on the consumer side.
Quickstart
kotlin
import dev.moq.*
import kotlinx.coroutines.flow.collect
import uniffi.moq.MoqOriginProducer
val session = Moq.connect("https://relay.example.com")
MoqOriginProducer().use { origin ->
val consumer = origin.consume()
val announced = consumer.announced("demos/")
announced.announcements().collect { announcement ->
println("got broadcast ${announcement.path()}")
announcement.broadcast().subscribeCatalog().updates().collect { catalog ->
println("catalog: $catalog")
}
}
}Cancelling the surrounding coroutine scope propagates through to the native consumer's cancel() via the wrapper's onCompletion hook.
Source and issues
- Source: kt/ (in the monorepo)
- README: kt/README.md
- Maven Central: dev.moq:moq