Skip to content

Krossbow Web Socket Built-in

The krossbow-websocket-builtin module defines implementations of the WebSocketClient interface by adapting clients that already exist in each platform (without 3rd-party dependencies).

For convenience in common source sets, this module also provides the builtIn() factory method, which returns the built-in implementation of the current platform.

JVM

On the JVM target, the Jdk11WebSocketClient adapts the built-in HttpClient provided in the JRE since Java 11, and its WebSocket interface.

Android not supported

This adapter requires Java 11's HttpClient which is not available on Android. If you need to support Android, please use the OkHttp or Ktor adapter instead.

JavaScript

On the JS target, the BrowserWebSocketClient adapts the browser's built-in WebSocket directly.

Also, the JsWebSocketClientAdapter allows to adapt anything that looks like the browser's WebSocket.

Darwin (macOS, iOS, tvOS, watchOS)

On all Darwin targets, the DarwinWebSocketClient adapts the Foundation framework's NSURLSessionWebSocketTask.

Dependency information

To use the built-in web socket clients, add the following to your build.gradle:

implementation("org.hildan.krossbow:krossbow-websocket-builtin:7.0.0")