netwerk/protocol/websocket/nsIWebSocketListener.idl

Thu, 15 Jan 2015 15:55:04 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 15:55:04 +0100
branch
TOR_BUG_9701
changeset 9
a63d609f5ebe
permissions
-rw-r--r--

Back out 97036ab72558 which inappropriately compared turds to third parties.

     1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
     2 /* vim: set sw=4 ts=4 et tw=80 : */
     3 /* This Source Code Form is subject to the terms of the Mozilla Public
     4  * License, v. 2.0. If a copy of the MPL was not distributed with this
     5  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     7 #include "nsISupports.idl"
     9 /**
    10  * nsIWebSocketListener: passed to nsIWebSocketChannel::AsyncOpen. Receives
    11  * websocket traffic events as they arrive.
    12  */
    13 [scriptable, uuid(d74c96b2-65b3-4e39-9e39-c577de5d7a73)]
    14 interface nsIWebSocketListener : nsISupports
    15 {
    16     /**
    17      * Called to signify the establishment of the message stream.
    18      * 
    19      * Unlike most other networking channels (which use nsIRequestObserver
    20      * instead of this class), we do not guarantee that OnStart is always
    21      * called: OnStop is called without calling this function if errors occur
    22      * during connection setup.  If the websocket connection is successful,
    23      * OnStart will be called before any other calls to this API.
    24      *
    25      * @param aContext user defined context
    26      */
    27     void onStart(in nsISupports aContext);
    29     /**
    30      * Called to signify the completion of the message stream.
    31      * OnStop is the final notification the listener will receive and it
    32      * completes the WebSocket connection: after it returns the
    33      * nsIWebSocketChannel will release its reference to the listener.
    34      * 
    35      * Note: this event can be received in error cases even if
    36      * nsIWebSocketChannel::Close() has not been called.
    37      *
    38      * @param aContext user defined context
    39      * @param aStatusCode reason for stopping (NS_OK if completed successfully)
    40      */
    41     void onStop(in nsISupports aContext,
    42                 in nsresult aStatusCode);
    44     /**
    45      * Called to deliver text message.
    46      *
    47      * @param aContext user defined context
    48      * @param aMsg the message data
    49      */
    50     void onMessageAvailable(in nsISupports aContext,
    51                             in AUTF8String aMsg);
    53     /**
    54      * Called to deliver binary message.
    55      *
    56      * @param aContext user defined context
    57      * @param aMsg the message data
    58      */
    59     void onBinaryMessageAvailable(in nsISupports aContext,
    60                                   in ACString aMsg);
    62     /**
    63      * Called to acknowledge message sent via sendMsg() or sendBinaryMsg.
    64      *
    65      * @param aContext user defined context
    66      * @param aSize number of bytes placed in OS send buffer
    67      */
    68     void onAcknowledge(in nsISupports aContext, in uint32_t aSize);
    70     /**
    71      * Called to inform receipt of WebSocket Close message from server.
    72      * In the case of errors onStop() can be called without ever
    73      * receiving server close.
    74      *
    75      * No additional messages through onMessageAvailable(),
    76      * onBinaryMessageAvailable() or onAcknowledge() will be delievered
    77      * to the listener after onServerClose(), though outgoing messages can still
    78      * be sent through the nsIWebSocketChannel connection.
    79      *
    80      * @param aContext user defined context
    81      * @param aCode the websocket closing handshake close code.
    82      * @param aReason the websocket closing handshake close reason
    84      */
    85     void onServerClose(in nsISupports aContext, in unsigned short aCode,
    86                        in AUTF8String aReason);
    88 };

mercurial