W3cubDocs

/Haxe JavaScript

WebSocket

package js.html

extends EventTarget

@:native("WebSocket") Available on js

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:

Constructor

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

new (url:String)

new (url:String, protocols:String)

Throws:

null DOMError

Variables

binaryType:BinaryType

read only bufferedAmount:Int

read only extensions:String

onclose:Function

onerror:Function

onmessage:Function

onopen:Function

read only protocol:String

read only readyState:Int

read only url:String

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

Static variables

@:value(3) static inline read only CLOSED:Int = 3

@:value(2) static inline read only CLOSING:Int = 2

@:value(0) static inline read only CONNECTING:Int = 0

@:value(1) static inline read only OPEN:Int = 1

© 2005–2018 Haxe Foundation
Licensed under a MIT license.
https://api.haxe.org/js/html/WebSocket.html