Skip to content

Overview

Krossbow is a Kotlin multiplatform STOMP 1.2 client with a coroutine-based API.

It is built on a web socket client abstraction, and provides a bunch of adapters for popular web socket clients (OkHttp, Ktor, Spring, SockJS...). It also provides out-of-the-box a built-in web socket implementation (without third-party dependencies) for most platforms (see below).

Krossbow can also be used as a multiplatform web socket client without STOMP protocol.

Features

All the STOMP 1.2 specification is implemented:

  • All STOMP frames, including ACK/NACK and transactions
  • Text and binary bodies
  • Receipts (waiting for RECEIPT frame based on receipt header)
  • Heart beats (keep alive)
  • Custom headers where the protocol allows them

Additional features:

  • Auto-receipts (automatically adds receipt headers to ensure no frame is lost)
  • Built-in body conversions (Kotlinx Serialization or Jackson)
  • Possibility to hook custom body converters (for textual or binary bodies)
  • Automatic content length header for sent frames

If you find a bug or a feature that's missing compared to the specification, please open an issue.

Supported targets

Krossbow supports most Kotlin targets in its STOMP and web socket API modules: JVM, JS (browser and nodeJS), iOS, watchOS, tvOS, macOSX64, linuxX64, mingwX64.

However, each web socket client implementation has its own subset of supported targets (see below).

Android not tested on CI

Android 5.0+ (API level 21+) is supported by using JVM artifacts (e.g. OkHttp). However, the Android tooling's desugaring is currently not tested as part of the build, so any feedback on this use case is more than welcome. Please upvote the corresponding issue if you'd like to see proper CI or special packaging for the Android target.

Web socket clients target support

Krossbow can use built-in web socket implementations without third-party dependencies on some platforms. It also provides adapters for third-party implementations which have different platform support. Here is a summary of the supported platforms by module:

Module Browser NodeJS JVM iOS / tvOS / watchOS macOS / Linux / Windows Transitive dependencies
Built-in ✅ ✅ (JDK 11+) ✅ None
Ktor ✅ ✅ ✅ ✅ ✅ Ktor, and the relevant Ktor engine(s)
OkHttp ✅ OkHttp
SockJS 🔶 🔶 🔶 sockjs-client (on JS), Spring websocket (on JVM)
Spring ✅ 🔶 Spring websocket

✅ supported with actual web socket transport (RFC6455)

🔶 supported using SockJS protocol (requires a SockJS server)

Contribute

Don't hesitate to open GitHub issues, even to ask questions or discuss a new feature. Pull-requests are welcome, but please open an issue first so that we can discuss the initial design or fix, which may avoid unnecessary work.