Skip to content

WebSocketTransport

//fluxbase-kotlin/io.github.nimbleflux.fluxbase.realtime/WebSocketTransport

interface WebSocketTransport

SPI for WebSocket I/O — the seam where tests inject a fake transport (see FakeWebSocketTransport) instead of a real WS connection.

The real implementation uses Ktor’s WebSocket client; the fake simulates server messages via FakeWebSocketTransport.simulateMessage.

KtorWebSocketTransport
Name Summary
isConnected [jvm]
abstract val isConnected: Boolean
Whether the transport is currently connected.
Name Summary
close [jvm]
abstract fun close()
Close the connection.
connect [jvm]
abstract fun connect(url: String): Flow<String>
Connect to the given URL and return a flow of incoming JSON text messages.
send [jvm]
abstract suspend fun send(text: String)
Send a text message.