StompClient

class StompClient(webSocketClient: WebSocketClient, config: StompConfig)(source)

A STOMP 1.2 client based on web sockets. A custom web socket implementation can be passed in as a constructor parameter.

The client is used to connect to the server and create a StompSession. Then, most of the STOMP interactions are done through the StompSession until it is disconnected.

The same client can be reused to start multiple sessions in general, unless a particular limitation from the underlying web socket implementation prevents this.

Constructors

Link copied to clipboard
constructor(webSocketClient: WebSocketClient, configure: StompConfig.() -> Unit = {})
constructor(webSocketClient: WebSocketClient, config: StompConfig)

Functions

Link copied to clipboard
suspend fun connect(url: String, login: String? = null, passcode: String? = null, host: String? = DefaultHost, customStompConnectHeaders: Map<String, String> = emptyMap(), sessionCoroutineContext: CoroutineContext = EmptyCoroutineContext): StompSession

Connects to the given WebSocket url and to the STOMP session, and returns after receiving the CONNECTED frame.