KtorWebSocketTransport

Default WebSocketTransport backed by a Ktor WebSocket session.

Constructors

Link copied to clipboard
constructor(websocketUrl: String)

Properties

Link copied to clipboard
open override val isActive: Boolean

Whether the underlying connection is currently open.

Functions

Link copied to clipboard
open suspend override fun close()

Closes the connection.

Link copied to clipboard
open suspend override fun connect()

Opens the connection. Must be called before send or incoming. No-op if already open.

Link copied to clipboard
open override fun incoming(): Flow<String>

Cold stream of raw text payloads received from the browser. Collecting it starts consuming frames; the flow completes when the connection is closed.

Link copied to clipboard
open suspend override fun send(message: String)

Sends a raw text payload to the browser.