Low-level websocket API: handles network protocol.
This is primarly intended for use by the higher-level nsIWebSocket.idl.
We are also making it scriptable for now, but this may change once we have
WebSockets for Workers.
Asynchronously open the websocket connection. Received messages are fed
to the socket listener as they arrive. The socket listener’s methods
are called on the thread that calls asyncOpen and are not called until
after asyncOpen returns. If asyncOpen returns successfully, the
protocol implementation promises to call at least onStop on the listener.
NOTE: Implementations should throw NS_ERROR_ALREADY_OPENED if the
websocket connection is reopened.
aURI | the uri of the websocket protocol - may be redirected |
aOrigin | the uri of the originating resource |
aListener | the nsIWebSocketListener implementation |
aContext | an opaque parameter forwarded to aListener's methods |
Use to send text message down the connection to WebSocket peer.
aMsg | the utf8 string to send |
Use to send binary message down the connection to WebSocket peer.
aMsg | the data to send |
Use to send a binary stream (Blob) to Websocket peer.
aStream | The input stream to be sent. |
The original URI used to construct the protocol connection. This is used
in the case of a redirect or URI “resolution” (e.g. resolving a
resource: URI to a file: URI) so that the original pre-redirect
URI can still be obtained. This is never null.
The readonly URI corresponding to the protocol connection after any
redirections are completed.
The notification callbacks for authorization, etc..
Transport-level security information (if any)
The load group of of the websocket
The load info of the websocket
Sec-Websocket-Protocol value
Sec-Websocket-Extensions response header value
This value determines how often (in seconds) websocket keepalive
pings are sent. If set to 0 (the default), no pings are ever sent.
This value can currently only be set before asyncOpen is called, else
NS_ERROR_IN_PROGRESS is thrown.
Be careful using this setting: ping traffic can consume lots of power and
bandwidth over time.
This value determines how long (in seconds) the websocket waits for
the server to reply to a ping that has been sent before considering the
connection broken.
This value can currently only be set before asyncOpen is called, else
NS_ERROR_IN_PROGRESS is thrown.