Get started

Get started with kcoap

kcoap 0.1.0 is on Maven Central. Add the modules you need through the bill of materials, then follow the guide for your platform.

  • Version0.1.0
  • Released6 November 2026
  • Groupdev.kcoap
  • RepositoryMaven Central

Platforms

Choose your platform

The protocol code is the same everywhere. Each guide lists the modules for that target, a first client and server, and what works there today.

Before you start

Prerequisites

What your project needs to use kcoap.

Repository
Maven Central, which also has every library kcoap depends on. kcoap needs no other repository and no token.
JVM bytecode
Java 17. Your project compiles to Java 17 or newer.
Kotlin
2.3 or newer in your project, as the versioning policy says. kcoap is built with Kotlin 2.4.21, and the samples use it.
Android
API level 26 (Android 8.0) or later.
iOS and macOS
A Mac with Apple silicon and Xcode. No minimum OS version is set yet.
Browsers and Node.js
No minimum version is set. Kotlin/Wasm needs a browser with WebAssembly garbage collection.

Install

Two steps, on every platform

These steps are the same for every target. The platform guides repeat them with the build file that target needs.

  1. Add the modules you need

    kcoap comes from mavenCentral(). Import the bill of materials, kcoap-bom, and name the modules without a version: they share internal plumbing, so a build uses one version for all of them, and the BOM sets it, also for the modules they bring along and when a library brings a newer kcoap.

    Kotlin DSL

    build.gradle.kts

    repositories {
        mavenCentral()
    }
    
    dependencies {
        implementation(platform("dev.kcoap:kcoap-bom:0.1.0"))
        implementation("dev.kcoap:kcoap-coap")            // client, server
        implementation("dev.kcoap:kcoap-transport-ktor")  // UDP, TCP
        implementation("dev.kcoap:kcoap-crypto-default")  // cryptography
        implementation("dev.kcoap:kcoap-oscore")          // OSCORE
        implementation("dev.kcoap:kcoap-edhoc-oscore")    // EDHOC, OSCORE
    }

    Version catalog

    gradle/libs.versions.toml

    [versions]
    kcoap = "0.1.0"
    
    [libraries]
    kcoap-bom = { module = "dev.kcoap:kcoap-bom", version.ref = "kcoap" }
    kcoap-coap = { module = "dev.kcoap:kcoap-coap" }
    kcoap-transport-ktor = { module = "dev.kcoap:kcoap-transport-ktor" }
    kcoap-crypto-default = { module = "dev.kcoap:kcoap-crypto-default" }
    kcoap-oscore = { module = "dev.kcoap:kcoap-oscore" }
    kcoap-edhoc-oscore = { module = "dev.kcoap:kcoap-edhoc-oscore" }
    
    [bundles]
    kcoap = [
        "kcoap-coap",
        "kcoap-transport-ktor",
        "kcoap-crypto-default",
        "kcoap-oscore",
        "kcoap-edhoc-oscore",
    ]

    build.gradle.kts

    repositories {
        mavenCentral()
    }
    
    dependencies {
        implementation(platform(libs.kcoap.bom))
        implementation(libs.bundles.kcoap)
    }

    In a Kotlin Multiplatform project the BOM and the same coordinates go into commonMain.dependencies, the BOM as implementation(project.dependencies.platform(...)), except the adapters a target lacks: browsers and Node.js use kcoap-transport-ktor-websocket instead of kcoap-transport-ktor. Maven builds import the BOM with <scope>import</scope> and name the -jvm artifacts (kcoap-bom).

  2. Follow the guide for your platform

    Each guide has the build file for its target, a first client and server, and the notes that matter there: transports, the crypto backend, minimum versions and what is not done yet.

    Start with the JVM Compare platforms

On Maven Central

The coordinates are dev.kcoap:<module>:0.1.0 from mavenCentral(), under the verified dev.kcoap namespace, and the release key signs every artifact. Each release also goes to GitHub Packages, which needs a GitHub token to read. Releases lists the versions.

Modules

Which modules to add

Seventeen modules are published. An application usually needs four or five of them; the rest come in as dependencies.

ModuleAdd it forTargets
kcoap-coapCoapClient and CoapServer; brings the message model, the transport interfaces and kotlinx.coroutinesall
kcoap-crypto-defaultThe platform’s cryptography. No other module brings it: every app adds it, or a classical backend of its ownall
kcoap-transport-ktorUDP (coap) and TCP (coap+tcp) sockets on ktor-network; on the JVM, also a TLS client (coaps+tcp)JVM, Android, Apple, Linux
kcoap-transport-ktor-websocketThe WebSocket client (coap+ws; coaps+ws on Apple platforms and the web, or on an HTTP client you pass whose engine checks host names, such as OkHttp, not CIO)all
kcoap-transport-ktor-websocket-serverThe WebSocket server, with a ktor server engine you add, such as io.ktor:ktor-server-cioJVM, Apple, Linux
kcoap-oscoreOSCORE with pre-shared keys; add kcoap-coap too to run it through the client and serverall
kcoap-edhoc-oscoreEDHOC over CoAP, into OSCORE, with the combined request; brings kcoap-edhoc, kcoap-oscore and kcoap-coapall
kcoap-crypto-bcPost-quantum EDHOC: ML-KEM and ML-DSA on Bouncy Castle, around a classical backend you pass, usually DefaultCryptoBackend() from kcoap-crypto-defaultJVM, Android
kcoap-testkitTests without a network: a lossy in-memory network and in-memory connections on virtual timeall

The other published modules (kcoap-common, kcoap-crypto, kcoap-cbor, kcoap-cose, kcoap-transport, kcoap-coap-message, kcoap-edhoc) come in through these, and kcoap-crypto-testsuite is for the tests of a CryptoBackend of your own. kcoap-dtls is built and tested but not published until its engine exists. All modules in the README.

Compare

What works where

The protocol code is common, so CoAP, OSCORE and EDHOC behave the same on every target. What differs is the transports a runtime allows, the cryptography underneath and how much has been tested there.

 JVMAndroidiOS and macOSLinuxBrowsersNode.js
Kotlin targetjvmjvm, from API level 26iosArm64, iosSimulatorArm64, macosArm64linuxX64js, wasmJsjs, wasmJs
UDP and TCPyesyesyesBSD socketsyesnobrowsers have neitherdeferredno adapter yet
WebSocket clientyesCIO engineyesCIO engineyesURLSessionyesCIO engineyesthe browser’s WebSocketyesnpm ws
TLS clientyescoaps+tcp; coaps+ws on an HTTP client you pass whose engine checks host namesnot runas on the JVMpartialcoaps+ws on URLSession; no coaps+tcpnono TLS in ktor on nativeyescoaps+ws, the browser’s wssyescoaps+ws
WebSocket serveryesnonot for appsyesyesnono
CryptographyJCAJCACryptoKit, CommonCryptoOpenSSL 3, linked inWebCryptoWebCrypto
EDHOC suites0–6, 240, 2, 4, 24 cross-tested; −24 with kcoap-crypto-bcnot run yetthe device’s providers decide; −24 with kcoap-crypto-bcin CI onlythe macOS job’s capability report0–6, 24OpenSSL 30–3, 6, 24where X25519 and Ed25519 exist, else 2, 3, 24; no ChaCha20-Poly13050–3, 6, 24no ChaCha20-Poly1305
Post-quantum EDHOCyeskcoap-crypto-bcbuildskcoap-crypto-bc; not run on a deviceto doto doto doto do
Tested in CIcommon tests, real sockets, interop with libcoap and libedhocAPI level 26 checks; a sample app built with R8 and lint; no device run yetcommon tests on macOS and the iOS simulator; a Swift smoke test; no iPhone run yetcommon tests as native code; WebSocket loopbackcommon tests on Node.js; the js WebSocket client in headless Chromecommon tests; the WebSocket client against an npm ws server
GuideJVMAndroidiOS and macOSLinuxBrowsersNode.js

Servers terminate TLS at a reverse proxy on every platform: kcoap has no TLS listener of its own (TLS per runtime). EDHOC asks the backend which suites it can run and offers only those, so a suite that a platform lacks is never offered there. The algorithms each target reports, and the suites that follow, are in algorithms and EDHOC suites per target.

Help

If the build cannot find kcoap

Could not find dev.kcoap:…:0.1.0
Check that mavenCentral() is in your repositories. In a settings file with dependencyResolutionManagement, the repositories go there. kcoap-dtls is not published, so no build finds it.
Some kcoap classes are missing at runtime
Check that every kcoap module has the same version: import kcoap-bom and leave the version off the modules. ./gradlew dependencies shows the version each one resolved to.
Still stuck
SUPPORT.md says where to ask. Each platform guide has its own troubleshooting list.