Session

open class Session(webSocket: WebSocket)

Session represents a session via websocket after connection was successful. Within a Session you can exchange data with the remote endpoint bi-directionaly.

Constructors

Link copied to clipboard
constructor(webSocket: WebSocket)

Properties

Link copied to clipboard

gives a Flow of CloseEvent when Session closes

Link copied to clipboard
val errors: Flow<Event>

gives a Flow of error Event when they get fired

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

gives a Flow of Boolean when SessionState is SessionState.Open

Link copied to clipboard

gives a Flow of MessageEvent when the remote endpoint sends them

Link copied to clipboard
val Session.opens: Flow<Event>

gives a Flow of Event when Session opens

Link copied to clipboard
val state: MutableStateFlow<SessionState>

gives the actual SessionState as Flow.

Functions

Link copied to clipboard
suspend fun close(code: Short = 1000, reason: String = "")

closes the current open Session.

Link copied to clipboard
suspend fun send(message: String)
suspend fun send(message: ArrayBuffer)
suspend fun send(message: ArrayBufferView)
suspend fun send(message: Blob)

sends a new message to the remote endpoint