netwerk/protocol/websocket/nsIWebSocketListener.idl

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

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

mercurial