| 1 |
// Copyright 2013 The Closure Library Authors. All Rights Reserved. |
| 2 |
// |
| 3 |
// Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 |
// you may not use this file except in compliance with the License. |
| 5 |
// You may obtain a copy of the License at |
| 6 |
// |
| 7 |
// http://www.apache.org/licenses/LICENSE-2.0 |
| 8 |
// |
| 9 |
// Unless required by applicable law or agreed to in writing, software |
| 10 |
// distributed under the License is distributed on an "AS-IS" BASIS, |
| 11 |
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 |
// See the License for the specific language governing permissions and |
| 13 |
// limitations under the License. |
| 14 |
|
| 15 |
/** |
| 16 |
* @fileoverview Transport support for WebChannel. |
| 17 |
* |
| 18 |
* The <code>WebChannelTransport</code> implementation serves as the factory |
| 19 |
* for <code>WebChannel</code>, which offers an abstraction for |
| 20 |
* point-to-point socket-like communication similar to what BrowserChannel |
| 21 |
* or HTML5 WebSocket offers. |
| 22 |
* |
| 23 |
*/ |
| 24 |
|
| 25 |
goog.provide('goog.net.WebChannelTransport'); |
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
/** |
| 30 |
* A WebChannelTransport instance represents a shared context of logical |
| 31 |
* connectivity between a browser client and a remote origin. |
| 32 |
* |
| 33 |
* Over a single WebChannelTransport instance, multiple WebChannels may be |
| 34 |
* created against different URLs, which may all share the same |
| 35 |
* underlying connectivity (i.e. TCP connection) whenever possible. |
| 36 |
* |
| 37 |
* When multi-domains are supported, such as CORS, multiple origins may be |
| 38 |
* supported over a single WebChannelTransport instance at the same time. |
| 39 |
* |
| 40 |
* Sharing between different window contexts such as tabs is not addressed |
| 41 |
* by WebChannelTransport. Applications may choose HTML5 shared workers |
| 42 |
* or other techniques to access the same transport instance |
| 43 |
* across different window contexts. |
| 44 |
* |
| 45 |
* @interface |
| 46 |
*/ |
| 47 |
goog.net.WebChannelTransport = function() {}; |
| 48 |
|
| 49 |
|
| 50 |
/** |
| 51 |
* The client version. This integer value will be passed to the server |
| 52 |
* when a channel is opened to inform the server the client "capabilities". |
| 53 |
* |
| 54 |
* Wire protocol version is a different concept and is internal to the |
| 55 |
* transport implementation. |
| 56 |
* |
| 57 |
* @const |
| 58 |
* @type {number} |
| 59 |
*/ |
| 60 |
goog.net.WebChannelTransport.CLIENT_VERSION = 22; |
| 61 |
|
| 62 |
|
| 63 |
/** |
| 64 |
* Create a new WebChannel instance. |
| 65 |
* |
| 66 |
* The new WebChannel is to be opened against the server-side resource |
| 67 |
* as specified by the given URL. See {@link goog.net.WebChannel} for detailed |
| 68 |
* semantics. |
| 69 |
* |
| 70 |
* @param {string} url The URL path for the new WebChannel instance. |
| 71 |
* @param {!goog.net.WebChannel.Options=} opt_options Configuration for the |
| 72 |
* new WebChannel instance. The configuration object is reusable after |
| 73 |
* the new channel instance is created. |
| 74 |
* @return {!goog.net.WebChannel} the newly created WebChannel instance. |
| 75 |
*/ |
| 76 |
goog.net.WebChannelTransport.prototype.createWebChannel = goog.abstractMethod; |