The WebSocket object provides the API for creating and managing a WebSocket connection to a server, as well as for sending and receiving data on the connection.

Documentation WebSocket by Mozilla Contributors, licensed under CC-BY-SA 2.5.

See also:

Static variables

@:value(3)staticinlineread onlyCLOSED:Int = 3

@:value(2)staticinlineread onlyCLOSING:Int = 2

@:value(0)staticinlineread onlyCONNECTING:Int = 0

@:value(1)staticinlineread onlyOPEN:Int = 1

Constructor

new(url:String, protocols:Array<String>)

new(url:String)

new(url:String, protocols:String)

Throws:

null

DOMError

Variables

Methods

close(?code:Int, ?reason:String):Void

Throws:

null

DOMError

send(data:ArrayBufferView):Void

send(data:String):Void

send(data:Blob):Void

send(data:ArrayBuffer):Void

Throws:

null

DOMError

Inherited Variables

Inherited Methods

Defined by EventTarget

@:value({ capture : false })addEventListener(type:String, listener:Function, capture:Bool = false):Void

@:value({ capture : false })addEventListener(type:String, listener:EventListener, capture:Bool = false, ?wantsUntrusted:Bool):Void

Throws:

null

DOMError

dispatchEvent(event:Event):Bool

Throws:

null

DOMError

@:value({ capture : false })removeEventListener(type:String, listener:Function, capture:Bool = false):Void

@:value({ capture : false })removeEventListener(type:String, listener:EventListener, capture:Bool = false):Void

Throws:

null

DOMError