ServerMessageSession

class ServerMessageSession(host: String = "localhost", port: Int, endpoint: String)

Manages a client WebSocket session to a server.

Parameters

host

server hostname

port

server port to connect to

endpoint

WebSocket endpoint path segment (without leading slash)

Constructors

Link copied to clipboard
constructor(host: String = "localhost", port: Int, endpoint: String)

Properties

Link copied to clipboard

Whether a WebSocket session has been established and not yet closed.

Functions

Link copied to clipboard
suspend fun init(onReady: suspend () -> Unit = {})

Initializes (if not already initialized) the WebSocket connection.

Link copied to clipboard
fun send(message: ServerMessage)

Sends a ServerMessage as a text frame.