WebSocket

package js.html

extends EventTarget

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 also:

Static variables

staticinlineread onlyCLOSED:Int = 3

staticinlineread onlyCLOSING:Int = 2

staticinlineread onlyCONNECTING:Int = 0

staticinlineread onlyOPEN:Int = 1

Constructor

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

new(url:String)

new(url:String, protocols:String)

Throws:

null

DOMError

Variables

binaryType:BinaryType

The binary data type used by the connection.

read onlybufferedAmount:Int

The number of bytes of queued data.

read onlyextensions:String

The extensions selected by the server.

onclose:Function

An event listener to be called when the connection is closed.

onerror:Function

An event listener to be called when an error occurs.

onmessage:Function

An event listener to be called when a message is received from the server.

onopen:Function

An event listener to be called when the connection is opened.

read onlyprotocol:String

The sub-protocol selected by the server.

read onlyreadyState:Int

The current state of the connection.

read onlyurl:String

The absolute URL of the WebSocket.

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

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