kvision / pl.treksoft.kvision.remote / Socket

Socket

class Socket

A websocket client implementation.

Constructors

<init>

Socket()

A websocket client implementation.

Properties

state

val state: Short

Functions

close

fun close(code: Short = 1000): Unit

Close a websocket.

connect

suspend fun connect(url: String, retryDelay: Long = 1000): Unit

Connect to a websocket.

isClosed

fun isClosed(): Boolean

Returns if a websocket is closed.

receive

suspend fun receive(): String

Receive a string from a websocket.

send

fun send(obj: String): Unit

Send string to a websocket.

Extension Functions

createInstance

fun <T> Any?.createInstance(vararg args: dynamic): T

Helper function for creating JavaScript objects from dynamic constructors.