Session

open class Session(webSocket: WebSocket)

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

Constructors

Session
Link copied to clipboard
js
fun Session(webSocket: WebSocket)

Functions

close
Link copied to clipboard
js
suspend fun close(code: Short = 1000, reason: String = "")
closes the current open Session.
equals
Link copied to clipboard
js
open operator fun equals(other: Any?): Boolean
hashCode
Link copied to clipboard
js
open fun hashCode(): Int
send
Link copied to clipboard
js
suspend fun send(message: String)
sends a new message to the remote endpoint
suspend fun send(message: ArrayBuffer)
sends a new message to the remote endpoint
suspend fun send(message: ArrayBufferView)
sends a new message to the remote endpoint
suspend fun send(message: Blob)
sends a new message to the remote endpoint
toString
Link copied to clipboard
js
open fun toString(): String

Properties

errors
Link copied to clipboard
js
val errors: Flow<Event>
gives a Flow of error Event when they get fired
messages
Link copied to clipboard
js
val messages: Flow<MessageEvent>
gives a Flow of MessageEvent when the remote endpoint sends them
state
Link copied to clipboard
js
val state: MutableStateFlow<SessionState>
gives the actual SessionState as Flow.

Extensions

closes
Link copied to clipboard
js
val Session.closes: Flow<CloseEvent>
gives a Flow of CloseEvent when Session closes
isClosed
Link copied to clipboard
js
val Session.isClosed: Flow<Boolean>
gives a Flow of Boolean when SessionState is SessionState.Closed
isConnecting
Link copied to clipboard
js
val Session.isConnecting: Flow<Boolean>
isOpen
Link copied to clipboard
js
val Session.isOpen: Flow<Boolean>
gives a Flow of Boolean when SessionState is SessionState.Open
opens
Link copied to clipboard
js
val Session.opens: Flow<Event>
gives a Flow of Event when Session opens