WebSocketTransport

Abstraction over the raw WebSocket connection used to talk to the browser.

Extracting this lets DefaultConnection's message plumbing (request/response correlation, event dispatch) be exercised without a real browser, by injecting a fake transport in tests.

Inheritors

Properties

Link copied to clipboard
abstract val isActive: Boolean

Whether the underlying connection is currently open.

Functions

Link copied to clipboard
abstract suspend fun close()

Closes the connection.

Link copied to clipboard
abstract suspend fun connect()

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

Link copied to clipboard
abstract 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
abstract suspend fun send(message: String)

Sends a raw text payload to the browser.