WebSocket

open external class WebSocket(url: String, protocols: dynamic) : EventTarget

Exposes the JavaScript WebSocket to Kotlin

Constructors

WebSocket
Link copied to clipboard
fun WebSocket(url: String, protocols: dynamic = definedExternally)

Types

Companion
Link copied to clipboard
object Companion

Functions

addEventListener
Link copied to clipboard
fun addEventListener(type: String, callback: (Event) -> Unit?, options: dynamic = definedExternally)
fun addEventListener(type: String, callback: EventListener?, options: dynamic = definedExternally)
close
Link copied to clipboard
fun close(code: Short = definedExternally, reason: String = definedExternally)
dispatchEvent
Link copied to clipboard
fun dispatchEvent(event: Event): Boolean
removeEventListener
Link copied to clipboard
fun removeEventListener(type: String, callback: (Event) -> Unit?, options: dynamic = definedExternally)
fun removeEventListener(type: String, callback: EventListener?, options: dynamic = definedExternally)
send
Link copied to clipboard
fun send(data: String)
fun send(data: ArrayBuffer)
fun send(data: ArrayBufferView)
fun send(data: Blob)

Properties

binaryType
Link copied to clipboard
var binaryType: BinaryType
bufferedAmount
Link copied to clipboard
open val bufferedAmount: Number
extensions
Link copied to clipboard
open val extensions: String
onclose
Link copied to clipboard
var onclose: (Event) -> dynamic?
onerror
Link copied to clipboard
var onerror: (Event) -> dynamic?
onmessage
Link copied to clipboard
var onmessage: (MessageEvent) -> dynamic?
onopen
Link copied to clipboard
var onopen: (Event) -> dynamic?
protocol
Link copied to clipboard
open val protocol: String
readyState
Link copied to clipboard
open val readyState: Short
url
Link copied to clipboard
open val url: String