UNPKG

1.71 kBTypeScriptView Raw
1/**
2 * @license
3 * Copyright 2017 Google LLC
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17import { RepoInfo } from '../core/RepoInfo';
18import { BrowserPollConnection } from './BrowserPollConnection';
19import { TransportConstructor } from './Transport';
20import { WebSocketConnection } from './WebSocketConnection';
21/**
22 * Currently simplistic, this class manages what transport a Connection should use at various stages of its
23 * lifecycle.
24 *
25 * It starts with longpolling in a browser, and httppolling on node. It then upgrades to websockets if
26 * they are available.
27 */
28export declare class TransportManager {
29 private transports_;
30 static get ALL_TRANSPORTS(): (typeof BrowserPollConnection | typeof WebSocketConnection)[];
31 /**
32 * @param repoInfo - Metadata around the namespace we're connecting to
33 */
34 constructor(repoInfo: RepoInfo);
35 private initTransports_;
36 /**
37 * @returns The constructor for the initial transport to use
38 */
39 initialTransport(): TransportConstructor;
40 /**
41 * @returns The constructor for the next transport, or null
42 */
43 upgradeTransport(): TransportConstructor | null;
44}