SocketConnection

One open WebSocket. OkHttpSocketConnector makes real ones; tests use an in-memory fake.

Properties

Link copied to clipboard
abstract val closeCode: Int?

The close code once closed (null while open or when none was sent).

Link copied to clipboard
abstract val closeReason: String?

The close reason once closed.

Link copied to clipboard
abstract val messages: Flow<String>

Text frames from the server, collected once. The flow completes when the socket closes; read closeCode and closeReason after that.

Functions

Link copied to clipboard
abstract suspend fun close(code: Int? = null, reason: String? = null)

Closes the socket with an optional code and reason.

Link copied to clipboard
abstract fun send(data: String)

Sends a text frame.