stomp

suspend fun WebSocketConnection.stomp(config: StompConfig, host: String? = DefaultHost, login: String? = null, passcode: String? = null, customHeaders: Map<String, String> = emptyMap(), sessionCoroutineContext: CoroutineContext = EmptyCoroutineContext): StompSession(source)

Establishes a STOMP session over an existing WebSocketConnection.

The behaviour of the STOMP protocol can be customized via the config. However, the semantics of StompConfig.connectionTimeout is slightly changed: it doesn't take into account the web socket connection time (since it already happened outside of this method call).

If login and passcode are provided, they are used for STOMP authentication.

The CONNECT/STOMP frame can be further customized by using customHeaders, which may be useful for server-specific behaviour, like token-based authentication.

If the connection at the STOMP level fails, the underlying web socket is closed.