
Rust-backed, high-performance WebTransport wrapper offering an idiomatic async API for establishing connections, managing uni/bi-directional streams and unreliable datagrams, plus TLS certificate handling.
kwtransport is a Kotlin Multiplatform library that provides a high-performance wrapper around the wtransport Rust crate, bringing WebTransport capabilities to your Kotlin applications across JVM, Android, and WebAssembly (WASM) targets. It aims to offer an idiomatic and robust Kotlin API for establishing WebTransport connections, managing streams, and handling datagrams with efficiency and ease.
[!IMPORTANT] Disclaimer: This project is almost entirely LLM-generated (via Gemini). The author has no knowledge of Rust and relied on AI to bridge the gap between Kotlin and the underlying Rust implementation. While it is functional and tested, there may be unidiomatic Rust code or performance pitfalls.
Contributions are highly welcome! If you are a Rust expert or a Kotlin Multiplatform enthusiast, your help in refining the FFI bridge, improving memory management, or expanding target support would be greatly appreciated.
wtransport Rust crate for underlying WebTransport protocol implementation.Flow for modern, non-blocking network operations.Add the dependency to your build.gradle.kts:
repositories {
mavenCentral()
}
dependencies {
implementation("io.github.arosov:kwtransport:0.0.2")
}Note: The JVM artifact automatically includes runtime dependencies for all currently supported native platforms (linux-x64, macos-arm64, windows-x64). You do not need to manually add classifier dependencies unless you are targeting a specific platform exclusively to save space.
The following platforms are officially supported:
| Platform | Architecture | Artifact Classifier | Notes |
|---|---|---|---|
| Linux | x86_64 | linux-x64 |
Standard desktop/server Linux (Ubuntu, Debian, etc.) |
| macOS | ARM64 | macos-arm64 |
Apple Silicon (M1/M2/M3) |
| Windows | x86_64 | windows-x64 |
64-bit Windows |
| Android | ARM64, ARMv7, x86, x86_64 | (bundled in AAR) | Handled automatically by Android Gradle Plugin |
| WASM | wasm-js |
(bundled in Klib) | WebAssembly for Browser targets |
Note: linux-arm64 and macos-x64 (Intel) are planned but not yet automatically built by the current CI pipeline.
To get started with kwtransport, ensure you have Java (JDK 17 or higher) and a recent version of the Kotlin Multiplatform plugin for Gradle installed.
To build the entire project:
./gradlew buildThe cli-chat module provides a simple command-line chat application to demonstrate basic client-server communication using WebTransport streams.
Build the distribution (run once, or after code changes):
./gradlew :cli-chat:installDistRun the server: Open a terminal and execute:
./cli-chat/build/install/cli-chat/bin/cli-chat -sRun the client (in a new terminal):
./cli-chat/build/install/cli-chat/bin/cli-chatType exit to close a chat session.
To run JVM tests for the kwtransport module:
./gradlew :kwtransport:cleanJvmTest :kwtransport:jvmTestFor other modules or specific targets, replace :kwtransport and :jvmTest as per the project's Gradle module conventions.
The core of the kwtransport API resides in the kwtransport module, primarily within the io.github.arosov.kwtransport package. Key classes include:
Endpoint: The entry point for creating client and server WebTransport endpoints.Connection: Represents an established WebTransport connection, allowing the opening and accepting of streams and sending/receiving datagrams.SendStream: For sending data over a WebTransport stream.RecvStream: For receiving data from a WebTransport stream, including a Flow<ByteArray> API for convenient consumption.Certificate: Utility for managing TLS certificates.KwTransportException and subclasses: Comprehensive exception hierarchy for robust error handling.For detailed code examples demonstrating how to use these components, please see the Usage Examples documentation.
This project is licensed under the MIT License. See the LICENSE file for details.
kwtransport is built upon the excellent work of the wtransport Rust crate, an implementation of the WebTransport (over HTTP3) protocol.
wtransport Author: Biagio Festa
wtransport Repository: https://github.com/BiagioFesta/wtransport
MIT License
Copyright (c) 2026 Your Name or Organization
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
kwtransport is a Kotlin Multiplatform library that provides a high-performance wrapper around the wtransport Rust crate, bringing WebTransport capabilities to your Kotlin applications across JVM, Android, and WebAssembly (WASM) targets. It aims to offer an idiomatic and robust Kotlin API for establishing WebTransport connections, managing streams, and handling datagrams with efficiency and ease.
[!IMPORTANT] Disclaimer: This project is almost entirely LLM-generated (via Gemini). The author has no knowledge of Rust and relied on AI to bridge the gap between Kotlin and the underlying Rust implementation. While it is functional and tested, there may be unidiomatic Rust code or performance pitfalls.
Contributions are highly welcome! If you are a Rust expert or a Kotlin Multiplatform enthusiast, your help in refining the FFI bridge, improving memory management, or expanding target support would be greatly appreciated.
wtransport Rust crate for underlying WebTransport protocol implementation.Flow for modern, non-blocking network operations.Add the dependency to your build.gradle.kts:
repositories {
mavenCentral()
}
dependencies {
implementation("io.github.arosov:kwtransport:0.0.2")
}Note: The JVM artifact automatically includes runtime dependencies for all currently supported native platforms (linux-x64, macos-arm64, windows-x64). You do not need to manually add classifier dependencies unless you are targeting a specific platform exclusively to save space.
The following platforms are officially supported:
| Platform | Architecture | Artifact Classifier | Notes |
|---|---|---|---|
| Linux | x86_64 | linux-x64 |
Standard desktop/server Linux (Ubuntu, Debian, etc.) |
| macOS | ARM64 | macos-arm64 |
Apple Silicon (M1/M2/M3) |
| Windows | x86_64 | windows-x64 |
64-bit Windows |
| Android | ARM64, ARMv7, x86, x86_64 | (bundled in AAR) | Handled automatically by Android Gradle Plugin |
| WASM | wasm-js |
(bundled in Klib) | WebAssembly for Browser targets |
Note: linux-arm64 and macos-x64 (Intel) are planned but not yet automatically built by the current CI pipeline.
To get started with kwtransport, ensure you have Java (JDK 17 or higher) and a recent version of the Kotlin Multiplatform plugin for Gradle installed.
To build the entire project:
./gradlew buildThe cli-chat module provides a simple command-line chat application to demonstrate basic client-server communication using WebTransport streams.
Build the distribution (run once, or after code changes):
./gradlew :cli-chat:installDistRun the server: Open a terminal and execute:
./cli-chat/build/install/cli-chat/bin/cli-chat -sRun the client (in a new terminal):
./cli-chat/build/install/cli-chat/bin/cli-chatType exit to close a chat session.
To run JVM tests for the kwtransport module:
./gradlew :kwtransport:cleanJvmTest :kwtransport:jvmTestFor other modules or specific targets, replace :kwtransport and :jvmTest as per the project's Gradle module conventions.
The core of the kwtransport API resides in the kwtransport module, primarily within the io.github.arosov.kwtransport package. Key classes include:
Endpoint: The entry point for creating client and server WebTransport endpoints.Connection: Represents an established WebTransport connection, allowing the opening and accepting of streams and sending/receiving datagrams.SendStream: For sending data over a WebTransport stream.RecvStream: For receiving data from a WebTransport stream, including a Flow<ByteArray> API for convenient consumption.Certificate: Utility for managing TLS certificates.KwTransportException and subclasses: Comprehensive exception hierarchy for robust error handling.For detailed code examples demonstrating how to use these components, please see the Usage Examples documentation.
This project is licensed under the MIT License. See the LICENSE file for details.
kwtransport is built upon the excellent work of the wtransport Rust crate, an implementation of the WebTransport (over HTTP3) protocol.
wtransport Author: Biagio Festa
wtransport Repository: https://github.com/BiagioFesta/wtransport
MIT License
Copyright (c) 2026 Your Name or Organization
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.