OLD | NEW |
(Empty) | |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 'use strict'; |
| 6 |
| 7 /** @suppress {duplicate} */ |
| 8 var remoting = remoting || {}; |
| 9 |
| 10 /** |
| 11 * Abstract interface for various signaling mechanisms. |
| 12 * |
| 13 * @interface |
| 14 * @extends {base.Disposable} |
| 15 */ |
| 16 remoting.SignalStrategy = function() {}; |
| 17 |
| 18 /** |
| 19 * @enum {number} SignalStrategy states. Possible state transitions: |
| 20 * NOT_CONNECTED -> CONNECTING (connect() called). |
| 21 * CONNECTING -> HANDSHAKE (connected successfully). |
| 22 * HANDSHAKE -> CONNECTED (authenticated successfully). |
| 23 * CONNECTING -> FAILED (connection failed). |
| 24 * HANDSHAKE -> FAILED (authentication failed). |
| 25 * * -> CLOSED (dispose() called). |
| 26 */ |
| 27 remoting.SignalStrategy.State = { |
| 28 NOT_CONNECTED: 0, |
| 29 CONNECTING: 1, |
| 30 HANDSHAKE: 2, |
| 31 CONNECTED: 3, |
| 32 FAILED: 4, |
| 33 CLOSED: 5 |
| 34 }; |
| 35 |
| 36 remoting.SignalStrategy.prototype.dispose = function() {}; |
| 37 |
| 38 /** |
| 39 * @param {?function(Element):void} onIncomingStanzaCallback Callback to call on |
| 40 * incoming messages. |
| 41 */ |
| 42 remoting.SignalStrategy.prototype.setIncomingStanzaCallback = |
| 43 function(onIncomingStanzaCallback) {}; |
| 44 |
| 45 /** |
| 46 * @param {string} server |
| 47 * @param {string} username |
| 48 * @param {string} authToken |
| 49 */ |
| 50 remoting.SignalStrategy.prototype.connect = |
| 51 function(server, username, authToken) { |
| 52 }; |
| 53 |
| 54 /** |
| 55 * Sends a message. Can be called only in CONNECTED state. |
| 56 * @param {string} message |
| 57 */ |
| 58 remoting.SignalStrategy.prototype.sendMessage = function(message) {}; |
| 59 |
| 60 /** @return {remoting.SignalStrategy.State} Current state */ |
| 61 remoting.SignalStrategy.prototype.getState = function() {}; |
| 62 |
| 63 /** @return {remoting.Error} Error when in FAILED state. */ |
| 64 remoting.SignalStrategy.prototype.getError = function() {}; |
| 65 |
| 66 /** @return {string} Current JID when in CONNECTED state. */ |
| 67 remoting.SignalStrategy.prototype.getJid = function() {}; |
OLD | NEW |