This is an experimental feature
Because this feature is still in development in some browsers, check the compatibility table for the proper prefixes to use in various browsers.
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.
Blob
objects are being used or "arraybuffer" if ArrayBuffer
objects are being used.readyState
changes to CLOSED
. The listener receives a CloseEvent
named "close".MessageEvent
named "message".readyState
changes to OPEN
; this indicates that the connection is ready to send and receive data. The event is a simple one with the name "open".protocols
parameter when creating the WebSocket object.Transmits data to the server over the WebSocket connection.
data
INVALID_STATE_ERR
OPEN
.SYNTAX_ERR
Gecko's implementation of the send()
method differs somewhat from the specification in Gecko 6.0; Gecko returns a boolean
indicating whether or not the connection is still open (and, by extension, that the data was successfully queued or transmitted); this is corrected in Gecko 8.0 (Firefox 8.0 / Thunderbird 8.0 / SeaMonkey 2.5)
. In addition, at this time, Gecko does not support ArrayBuffer
or Blob
data types.