Path: blob/trunk/third_party/closure/goog/labs/net/webchanneltransport.js
2868 views
// Copyright 2013 The Closure Library Authors. All Rights Reserved.1//2// Licensed under the Apache License, Version 2.0 (the "License");3// you may not use this file except in compliance with the License.4// You may obtain a copy of the License at5//6// http://www.apache.org/licenses/LICENSE-2.07//8// Unless required by applicable law or agreed to in writing, software9// distributed under the License is distributed on an "AS-IS" BASIS,10// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.11// See the License for the specific language governing permissions and12// limitations under the License.1314/**15* @fileoverview Transport support for WebChannel.16*17* The <code>WebChannelTransport</code> implementation serves as the factory18* for <code>WebChannel</code>, which offers an abstraction for19* point-to-point socket-like communication similar to what BrowserChannel20* or HTML5 WebSocket offers.21*22*/2324goog.provide('goog.net.WebChannelTransport');25262728/**29* A WebChannelTransport instance represents a shared context of logical30* connectivity between a browser client and a remote origin.31*32* Over a single WebChannelTransport instance, multiple WebChannels may be33* created against different URLs, which may all share the same34* underlying connectivity (i.e. TCP connection) whenever possible.35*36* When multi-domains are supported, such as CORS, multiple origins may be37* supported over a single WebChannelTransport instance at the same time.38*39* Sharing between different window contexts such as tabs is not addressed40* by WebChannelTransport. Applications may choose HTML5 shared workers41* or other techniques to access the same transport instance42* across different window contexts.43*44* @interface45*/46goog.net.WebChannelTransport = function() {};474849/**50* The client version. This integer value will be passed to the server51* when a channel is opened to inform the server the client "capabilities".52*53* Wire protocol version is a different concept and is internal to the54* transport implementation.55*56* @const57* @type {number}58*/59goog.net.WebChannelTransport.CLIENT_VERSION = 20;606162/**63* Create a new WebChannel instance.64*65* The new WebChannel is to be opened against the server-side resource66* as specified by the given URL. See {@link goog.net.WebChannel} for detailed67* semantics.68*69* @param {string} url The URL path for the new WebChannel instance.70* @param {!goog.net.WebChannel.Options=} opt_options Configuration for the71* new WebChannel instance. The configuration object is reusable after72* the new channel instance is created.73* @return {!goog.net.WebChannel} the newly created WebChannel instance.74*/75goog.net.WebChannelTransport.prototype.createWebChannel = goog.abstractMethod;767778