This article needs a technical review. How you can help.
nsIWebSocketChannel.asyncOpen()
.
nsISupports
Last changed in Gecko 8.0 (Firefox 8.0 / Thunderbird 8.0 / SeaMonkey 2.5)Method overview
void onAcknowledge(in nsISupports aContext, in PRUint32 aSize); |
void onBinaryMessageAvailable(in nsISupports aContext, in ACString aMsg); |
void onMessageAvailable(in nsISupports aContext, in AUTF8String aMsg); |
void onServerClose(in nsISupports aContext, in unsigned short aCode, in AUTF8String aReason); |
void onStart(in nsISupports aContext); |
void onStop(in nsISupports aContext, in nsresult aStatusCode); |
Methods
onAcknowledge()
Called to acknowledge a message sent via nsIWebSocketChannel.sendMsg()
or nsIWebSocketChannel.sendBinaryMsg()
.
void onAcknowledge( in nsISupports aContext, in PRUint32 aSize );
Parameters
-
aContext
- User defined context.
-
aSize
- Number of bytes placed in OS send buffer.
onBinaryMessageAvailable()
Called when a binary message has been received.
void onBinaryMessageAvailable( in nsISupports aContext, in ACString aMsg );
Parameters
-
aContext
- User defined context.
-
aMsg
- The message data.
onMessageAvailable()
Called when a text message has been received.
void onMessageAvailable( in nsISupports aContext, in AUTF8String aMsg );
Parameters
-
aContext
- User defined context.
-
aMsg
- The message data, as a UTF-8 string.
onServerClose()
Called when the server sends a close message. In the case of errors, onStop()
may be called without this method ever getting called.
No additional messages through onMessageAvailable()
, onBinaryMessageAvailable()
() or onAcknowledge()
() will be delievered to the listener after onServerClose()
is called, but outgoing messages can still be sent through the nsIWebSocketChannel
connection.
void onServerClose( in nsISupports aContext, in unsigned short aCode, in AUTF8String aReason );
Parameters
-
aContext
- User defined context.
-
aCode
- The WebSocket closing handshake status code; see Status codes for possible values.
-
aReason
- A text string explaining the reason for the closure of the connection.
onStart()
Called to signify the establishment of the message stream. Any listener that receives onStart()
will also receive OnStop()
.
void onStart( in nsISupports aContext );
Parameters
-
aContext
- User defined context.
onStop()
Called to signify the completion of the message stream. This is the final notification the listener will receive; once it's been received, the WebSocket connection is complete. This event can be received in error cases even if nsIWebSocketChannel.close()
has not been called.
void onStop( in nsISupports aContext, in nsresult aStatusCode );
Parameters
-
aContext
- User defined context.
-
aStatusCode
-
Reason for stopping (
NS_OK
if completed successfully).