RtcWebSocket

class RtcWebSocket(caCertificatesPem: String? = null) : Closeable

A single-use libdatachannel WebSocket. TLS verification is always enabled. WSS uses platform trust anchors by default, or an explicitly supplied PEM CA bundle. Receive and send queues are bounded. Cancel/close to release native resources.

Constructors

Link copied to clipboard
constructor(caCertificatesPem: String? = null)

Types

Link copied to clipboard
object Companion
Link copied to clipboard
data class Message(val data: ByteArray, val isBinary: Boolean)

Functions

Link copied to clipboard
open override fun close()
Link copied to clipboard
suspend fun connect(url: String)
Link copied to clipboard

Receives one complete text or binary frame, at most 1 MiB.

Link copied to clipboard
fun send(text: String)

Sends one UTF-8 text frame. Native buffering is bounded to 1 MiB.