@firebase/database 1.0.9 → 1.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +13834 -13834
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm2017.js +13834 -13834
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.node.cjs.js +13849 -13849
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/index.standalone.js +13797 -13797
- package/dist/index.standalone.js.map +1 -1
- package/dist/node-esm/index.node.esm.js +13849 -13849
- package/dist/node-esm/index.node.esm.js.map +1 -1
- package/dist/node-esm/src/api/Database.d.ts +137 -137
- package/dist/node-esm/src/api/OnDisconnect.d.ts +110 -110
- package/dist/node-esm/src/api/Reference.d.ts +122 -122
- package/dist/node-esm/src/api/Reference_impl.d.ts +1098 -1098
- package/dist/node-esm/src/api/ServerValue.d.ts +30 -30
- package/dist/node-esm/src/api/Transaction.d.ts +83 -83
- package/dist/node-esm/src/api/test_access.d.ts +31 -31
- package/dist/node-esm/src/api.d.ts +18 -18
- package/dist/node-esm/src/api.standalone.d.ts +30 -30
- package/dist/node-esm/src/core/AppCheckTokenProvider.d.ts +30 -30
- package/dist/node-esm/src/core/AuthTokenProvider.d.ts +49 -49
- package/dist/node-esm/src/core/CompoundWrite.d.ts +81 -81
- package/dist/node-esm/src/core/PersistentConnection.d.ts +135 -135
- package/dist/node-esm/src/core/ReadonlyRestClient.d.ts +60 -60
- package/dist/node-esm/src/core/Repo.d.ts +144 -144
- package/dist/node-esm/src/core/RepoInfo.d.ts +56 -56
- package/dist/node-esm/src/core/ServerActions.d.ts +52 -52
- package/dist/node-esm/src/core/SnapshotHolder.d.ts +26 -26
- package/dist/node-esm/src/core/SparseSnapshotTree.d.ts +64 -64
- package/dist/node-esm/src/core/SyncPoint.d.ts +91 -91
- package/dist/node-esm/src/core/SyncTree.d.ts +166 -166
- package/dist/node-esm/src/core/WriteTree.d.ts +205 -205
- package/dist/node-esm/src/core/operation/AckUserWrite.d.ts +36 -36
- package/dist/node-esm/src/core/operation/ListenComplete.d.ts +26 -26
- package/dist/node-esm/src/core/operation/Merge.d.ts +33 -33
- package/dist/node-esm/src/core/operation/Operation.d.ts +45 -45
- package/dist/node-esm/src/core/operation/Overwrite.d.ts +28 -28
- package/dist/node-esm/src/core/snap/ChildrenNode.d.ts +112 -112
- package/dist/node-esm/src/core/snap/IndexMap.d.ts +43 -43
- package/dist/node-esm/src/core/snap/LeafNode.d.ts +83 -83
- package/dist/node-esm/src/core/snap/Node.d.ts +126 -126
- package/dist/node-esm/src/core/snap/childSet.d.ts +32 -32
- package/dist/node-esm/src/core/snap/comparators.d.ts +19 -19
- package/dist/node-esm/src/core/snap/indexes/Index.d.ts +50 -50
- package/dist/node-esm/src/core/snap/indexes/KeyIndex.d.ts +34 -34
- package/dist/node-esm/src/core/snap/indexes/PathIndex.d.ts +29 -29
- package/dist/node-esm/src/core/snap/indexes/PriorityIndex.d.ts +33 -33
- package/dist/node-esm/src/core/snap/indexes/ValueIndex.d.ts +31 -31
- package/dist/node-esm/src/core/snap/nodeFromJSON.d.ts +24 -24
- package/dist/node-esm/src/core/snap/snap.d.ts +23 -23
- package/dist/node-esm/src/core/stats/StatsCollection.d.ts +26 -26
- package/dist/node-esm/src/core/stats/StatsListener.d.ts +30 -30
- package/dist/node-esm/src/core/stats/StatsManager.d.ts +20 -20
- package/dist/node-esm/src/core/stats/StatsReporter.d.ts +28 -28
- package/dist/node-esm/src/core/storage/DOMStorageWrapper.d.ts +46 -46
- package/dist/node-esm/src/core/storage/MemoryStorage.d.ts +27 -27
- package/dist/node-esm/src/core/storage/storage.d.ts +22 -22
- package/dist/node-esm/src/core/util/EventEmitter.d.ts +39 -39
- package/dist/node-esm/src/core/util/ImmutableTree.d.ts +117 -117
- package/dist/node-esm/src/core/util/NextPushId.d.ts +33 -33
- package/dist/node-esm/src/core/util/OnlineMonitor.d.ts +31 -31
- package/dist/node-esm/src/core/util/Path.d.ts +94 -94
- package/dist/node-esm/src/core/util/ServerValues.d.ts +56 -56
- package/dist/node-esm/src/core/util/SortedMap.d.ts +324 -324
- package/dist/node-esm/src/core/util/Tree.d.ts +105 -105
- package/dist/node-esm/src/core/util/VisibilityMonitor.d.ts +23 -23
- package/dist/node-esm/src/core/util/libs/parser.d.ts +32 -32
- package/dist/node-esm/src/core/util/misc.d.ts +19 -19
- package/dist/node-esm/src/core/util/util.d.ts +176 -176
- package/dist/node-esm/src/core/util/validation.d.ts +70 -70
- package/dist/node-esm/src/core/version.d.ts +23 -23
- package/dist/node-esm/src/core/view/CacheNode.d.ts +41 -41
- package/dist/node-esm/src/core/view/Change.d.ts +46 -46
- package/dist/node-esm/src/core/view/ChildChangeAccumulator.d.ts +22 -22
- package/dist/node-esm/src/core/view/CompleteChildSource.d.ts +55 -55
- package/dist/node-esm/src/core/view/Event.d.ts +64 -64
- package/dist/node-esm/src/core/view/EventGenerator.d.ts +42 -42
- package/dist/node-esm/src/core/view/EventQueue.d.ts +67 -67
- package/dist/node-esm/src/core/view/EventRegistration.d.ts +87 -87
- package/dist/node-esm/src/core/view/QueryParams.d.ts +95 -95
- package/dist/node-esm/src/core/view/View.d.ts +59 -59
- package/dist/node-esm/src/core/view/ViewCache.d.ts +32 -32
- package/dist/node-esm/src/core/view/ViewProcessor.d.ts +32 -32
- package/dist/node-esm/src/core/view/filter/IndexedFilter.d.ts +35 -35
- package/dist/node-esm/src/core/view/filter/LimitedFilter.d.ts +47 -47
- package/dist/node-esm/src/core/view/filter/NodeFilter.d.ts +54 -54
- package/dist/node-esm/src/core/view/filter/RangedFilter.d.ts +47 -47
- package/dist/node-esm/src/index.d.ts +28 -28
- package/dist/node-esm/src/index.node.d.ts +17 -17
- package/dist/node-esm/src/index.standalone.d.ts +17 -17
- package/dist/node-esm/src/internal/index.d.ts +38 -38
- package/dist/node-esm/src/realtime/BrowserPollConnection.d.ts +198 -198
- package/dist/node-esm/src/realtime/Connection.d.ts +102 -102
- package/dist/node-esm/src/realtime/Constants.d.ts +27 -27
- package/dist/node-esm/src/realtime/Transport.d.ts +58 -58
- package/dist/node-esm/src/realtime/TransportManager.d.ts +50 -50
- package/dist/node-esm/src/realtime/WebSocketConnection.d.ts +127 -127
- package/dist/node-esm/src/realtime/polling/PacketReceiver.d.ts +38 -38
- package/dist/node-esm/src/register.d.ts +1 -1
- package/dist/node-esm/test/compound_write.test.d.ts +17 -17
- package/dist/node-esm/test/connection.test.d.ts +17 -17
- package/dist/node-esm/test/deno.test.d.ts +17 -17
- package/dist/node-esm/test/exp/integration.test.d.ts +17 -17
- package/dist/node-esm/test/helpers/EventAccumulator.d.ts +35 -35
- package/dist/node-esm/test/helpers/syncpoint-util.d.ts +29 -29
- package/dist/node-esm/test/helpers/util.d.ts +34 -34
- package/dist/node-esm/test/node.test.d.ts +17 -17
- package/dist/node-esm/test/parser.test.d.ts +17 -17
- package/dist/node-esm/test/path.test.d.ts +17 -17
- package/dist/node-esm/test/pushid.test.d.ts +17 -17
- package/dist/node-esm/test/queryconstraint.test.d.ts +17 -17
- package/dist/node-esm/test/repoinfo.test.d.ts +17 -17
- package/dist/node-esm/test/sortedmap.test.d.ts +17 -17
- package/dist/node-esm/test/sparsesnapshottree.test.d.ts +17 -17
- package/dist/node-esm/test/syncpoint.test.d.ts +17 -17
- package/dist/node-esm/test/transport.test.d.ts +17 -17
- package/dist/node-esm/test/websocketconnection.test.d.ts +17 -17
- package/dist/src/api/Database.d.ts +137 -137
- package/dist/src/api/OnDisconnect.d.ts +110 -110
- package/dist/src/api/Reference.d.ts +122 -122
- package/dist/src/api/Reference_impl.d.ts +1098 -1098
- package/dist/src/api/ServerValue.d.ts +30 -30
- package/dist/src/api/Transaction.d.ts +83 -83
- package/dist/src/api/test_access.d.ts +31 -31
- package/dist/src/api.d.ts +18 -18
- package/dist/src/api.standalone.d.ts +30 -30
- package/dist/src/core/AppCheckTokenProvider.d.ts +30 -30
- package/dist/src/core/AuthTokenProvider.d.ts +49 -49
- package/dist/src/core/CompoundWrite.d.ts +81 -81
- package/dist/src/core/PersistentConnection.d.ts +135 -135
- package/dist/src/core/ReadonlyRestClient.d.ts +60 -60
- package/dist/src/core/Repo.d.ts +144 -144
- package/dist/src/core/RepoInfo.d.ts +56 -56
- package/dist/src/core/ServerActions.d.ts +52 -52
- package/dist/src/core/SnapshotHolder.d.ts +26 -26
- package/dist/src/core/SparseSnapshotTree.d.ts +64 -64
- package/dist/src/core/SyncPoint.d.ts +91 -91
- package/dist/src/core/SyncTree.d.ts +166 -166
- package/dist/src/core/WriteTree.d.ts +205 -205
- package/dist/src/core/operation/AckUserWrite.d.ts +36 -36
- package/dist/src/core/operation/ListenComplete.d.ts +26 -26
- package/dist/src/core/operation/Merge.d.ts +33 -33
- package/dist/src/core/operation/Operation.d.ts +45 -45
- package/dist/src/core/operation/Overwrite.d.ts +28 -28
- package/dist/src/core/snap/ChildrenNode.d.ts +112 -112
- package/dist/src/core/snap/IndexMap.d.ts +43 -43
- package/dist/src/core/snap/LeafNode.d.ts +83 -83
- package/dist/src/core/snap/Node.d.ts +126 -126
- package/dist/src/core/snap/childSet.d.ts +32 -32
- package/dist/src/core/snap/comparators.d.ts +19 -19
- package/dist/src/core/snap/indexes/Index.d.ts +50 -50
- package/dist/src/core/snap/indexes/KeyIndex.d.ts +34 -34
- package/dist/src/core/snap/indexes/PathIndex.d.ts +29 -29
- package/dist/src/core/snap/indexes/PriorityIndex.d.ts +33 -33
- package/dist/src/core/snap/indexes/ValueIndex.d.ts +31 -31
- package/dist/src/core/snap/nodeFromJSON.d.ts +24 -24
- package/dist/src/core/snap/snap.d.ts +23 -23
- package/dist/src/core/stats/StatsCollection.d.ts +26 -26
- package/dist/src/core/stats/StatsListener.d.ts +30 -30
- package/dist/src/core/stats/StatsManager.d.ts +20 -20
- package/dist/src/core/stats/StatsReporter.d.ts +28 -28
- package/dist/src/core/storage/DOMStorageWrapper.d.ts +46 -46
- package/dist/src/core/storage/MemoryStorage.d.ts +27 -27
- package/dist/src/core/storage/storage.d.ts +22 -22
- package/dist/src/core/util/EventEmitter.d.ts +39 -39
- package/dist/src/core/util/ImmutableTree.d.ts +117 -117
- package/dist/src/core/util/NextPushId.d.ts +33 -33
- package/dist/src/core/util/OnlineMonitor.d.ts +31 -31
- package/dist/src/core/util/Path.d.ts +94 -94
- package/dist/src/core/util/ServerValues.d.ts +56 -56
- package/dist/src/core/util/SortedMap.d.ts +324 -324
- package/dist/src/core/util/Tree.d.ts +105 -105
- package/dist/src/core/util/VisibilityMonitor.d.ts +23 -23
- package/dist/src/core/util/libs/parser.d.ts +32 -32
- package/dist/src/core/util/misc.d.ts +19 -19
- package/dist/src/core/util/util.d.ts +176 -176
- package/dist/src/core/util/validation.d.ts +70 -70
- package/dist/src/core/version.d.ts +23 -23
- package/dist/src/core/view/CacheNode.d.ts +41 -41
- package/dist/src/core/view/Change.d.ts +46 -46
- package/dist/src/core/view/ChildChangeAccumulator.d.ts +22 -22
- package/dist/src/core/view/CompleteChildSource.d.ts +55 -55
- package/dist/src/core/view/Event.d.ts +64 -64
- package/dist/src/core/view/EventGenerator.d.ts +42 -42
- package/dist/src/core/view/EventQueue.d.ts +67 -67
- package/dist/src/core/view/EventRegistration.d.ts +87 -87
- package/dist/src/core/view/QueryParams.d.ts +95 -95
- package/dist/src/core/view/View.d.ts +59 -59
- package/dist/src/core/view/ViewCache.d.ts +32 -32
- package/dist/src/core/view/ViewProcessor.d.ts +32 -32
- package/dist/src/core/view/filter/IndexedFilter.d.ts +35 -35
- package/dist/src/core/view/filter/LimitedFilter.d.ts +47 -47
- package/dist/src/core/view/filter/NodeFilter.d.ts +54 -54
- package/dist/src/core/view/filter/RangedFilter.d.ts +47 -47
- package/dist/src/index.d.ts +28 -28
- package/dist/src/index.node.d.ts +17 -17
- package/dist/src/index.standalone.d.ts +17 -17
- package/dist/src/internal/index.d.ts +38 -38
- package/dist/src/realtime/BrowserPollConnection.d.ts +198 -198
- package/dist/src/realtime/Connection.d.ts +102 -102
- package/dist/src/realtime/Constants.d.ts +27 -27
- package/dist/src/realtime/Transport.d.ts +58 -58
- package/dist/src/realtime/TransportManager.d.ts +50 -50
- package/dist/src/realtime/WebSocketConnection.d.ts +127 -127
- package/dist/src/realtime/polling/PacketReceiver.d.ts +38 -38
- package/dist/src/register.d.ts +1 -1
- package/dist/test/compound_write.test.d.ts +17 -17
- package/dist/test/connection.test.d.ts +17 -17
- package/dist/test/deno.test.d.ts +17 -17
- package/dist/test/exp/integration.test.d.ts +17 -17
- package/dist/test/helpers/EventAccumulator.d.ts +35 -35
- package/dist/test/helpers/syncpoint-util.d.ts +29 -29
- package/dist/test/helpers/util.d.ts +34 -34
- package/dist/test/node.test.d.ts +17 -17
- package/dist/test/parser.test.d.ts +17 -17
- package/dist/test/path.test.d.ts +17 -17
- package/dist/test/pushid.test.d.ts +17 -17
- package/dist/test/queryconstraint.test.d.ts +17 -17
- package/dist/test/repoinfo.test.d.ts +17 -17
- package/dist/test/sortedmap.test.d.ts +17 -17
- package/dist/test/sparsesnapshottree.test.d.ts +17 -17
- package/dist/test/syncpoint.test.d.ts +17 -17
- package/dist/test/transport.test.d.ts +17 -17
- package/dist/test/websocketconnection.test.d.ts +17 -17
- package/package.json +8 -8
|
@@ -1,198 +1,198 @@
|
|
|
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
|
-
*/
|
|
17
|
-
import { RepoInfo } from '../core/RepoInfo';
|
|
18
|
-
import { PacketReceiver } from './polling/PacketReceiver';
|
|
19
|
-
import { Transport } from './Transport';
|
|
20
|
-
export declare const FIREBASE_LONGPOLL_START_PARAM = "start";
|
|
21
|
-
export declare const FIREBASE_LONGPOLL_CLOSE_COMMAND = "close";
|
|
22
|
-
export declare const FIREBASE_LONGPOLL_COMMAND_CB_NAME = "pLPCommand";
|
|
23
|
-
export declare const FIREBASE_LONGPOLL_DATA_CB_NAME = "pRTLPCB";
|
|
24
|
-
export declare const FIREBASE_LONGPOLL_ID_PARAM = "id";
|
|
25
|
-
export declare const FIREBASE_LONGPOLL_PW_PARAM = "pw";
|
|
26
|
-
export declare const FIREBASE_LONGPOLL_SERIAL_PARAM = "ser";
|
|
27
|
-
export declare const FIREBASE_LONGPOLL_CALLBACK_ID_PARAM = "cb";
|
|
28
|
-
export declare const FIREBASE_LONGPOLL_SEGMENT_NUM_PARAM = "seg";
|
|
29
|
-
export declare const FIREBASE_LONGPOLL_SEGMENTS_IN_PACKET = "ts";
|
|
30
|
-
export declare const FIREBASE_LONGPOLL_DATA_PARAM = "d";
|
|
31
|
-
export declare const FIREBASE_LONGPOLL_DISCONN_FRAME_PARAM = "disconn";
|
|
32
|
-
export declare const FIREBASE_LONGPOLL_DISCONN_FRAME_REQUEST_PARAM = "dframe";
|
|
33
|
-
/**
|
|
34
|
-
* This class manages a single long-polling connection.
|
|
35
|
-
*/
|
|
36
|
-
export declare class BrowserPollConnection implements Transport {
|
|
37
|
-
connId: string;
|
|
38
|
-
repoInfo: RepoInfo;
|
|
39
|
-
private applicationId?;
|
|
40
|
-
private appCheckToken?;
|
|
41
|
-
private authToken?;
|
|
42
|
-
transportSessionId?: string;
|
|
43
|
-
lastSessionId?: string;
|
|
44
|
-
bytesSent: number;
|
|
45
|
-
bytesReceived: number;
|
|
46
|
-
urlFn: (params: object) => string;
|
|
47
|
-
scriptTagHolder: FirebaseIFrameScriptHolder;
|
|
48
|
-
myDisconnFrame: HTMLIFrameElement;
|
|
49
|
-
curSegmentNum: number;
|
|
50
|
-
myPacketOrderer: PacketReceiver;
|
|
51
|
-
id: string;
|
|
52
|
-
password: string;
|
|
53
|
-
private log_;
|
|
54
|
-
private stats_;
|
|
55
|
-
private everConnected_;
|
|
56
|
-
private isClosed_;
|
|
57
|
-
private connectTimeoutTimer_;
|
|
58
|
-
private onDisconnect_;
|
|
59
|
-
/**
|
|
60
|
-
* @param connId An identifier for this connection, used for logging
|
|
61
|
-
* @param repoInfo The info for the endpoint to send data to.
|
|
62
|
-
* @param applicationId The Firebase App ID for this project.
|
|
63
|
-
* @param appCheckToken The AppCheck token for this client.
|
|
64
|
-
* @param authToken The AuthToken to use for this connection.
|
|
65
|
-
* @param transportSessionId Optional transportSessionid if we are
|
|
66
|
-
* reconnecting for an existing transport session
|
|
67
|
-
* @param lastSessionId Optional lastSessionId if the PersistentConnection has
|
|
68
|
-
* already created a connection previously
|
|
69
|
-
*/
|
|
70
|
-
constructor(connId: string, repoInfo: RepoInfo, applicationId?: string, appCheckToken?: string, authToken?: string, transportSessionId?: string, lastSessionId?: string);
|
|
71
|
-
/**
|
|
72
|
-
* @param onMessage - Callback when messages arrive
|
|
73
|
-
* @param onDisconnect - Callback with connection lost.
|
|
74
|
-
*/
|
|
75
|
-
open(onMessage: (msg: {}) => void, onDisconnect: (a?: boolean) => void): void;
|
|
76
|
-
/**
|
|
77
|
-
* Call this when a handshake has completed successfully and we want to consider the connection established
|
|
78
|
-
*/
|
|
79
|
-
start(): void;
|
|
80
|
-
static forceAllow_: boolean;
|
|
81
|
-
/**
|
|
82
|
-
* Forces long polling to be considered as a potential transport
|
|
83
|
-
*/
|
|
84
|
-
static forceAllow(): void;
|
|
85
|
-
static forceDisallow_: boolean;
|
|
86
|
-
/**
|
|
87
|
-
* Forces longpolling to not be considered as a potential transport
|
|
88
|
-
*/
|
|
89
|
-
static forceDisallow(): void;
|
|
90
|
-
static isAvailable(): boolean;
|
|
91
|
-
/**
|
|
92
|
-
* No-op for polling
|
|
93
|
-
*/
|
|
94
|
-
markConnectionHealthy(): void;
|
|
95
|
-
/**
|
|
96
|
-
* Stops polling and cleans up the iframe
|
|
97
|
-
*/
|
|
98
|
-
private shutdown_;
|
|
99
|
-
/**
|
|
100
|
-
* Triggered when this transport is closed
|
|
101
|
-
*/
|
|
102
|
-
private onClosed_;
|
|
103
|
-
/**
|
|
104
|
-
* External-facing close handler. RealTime has requested we shut down. Kill our connection and tell the server
|
|
105
|
-
* that we've left.
|
|
106
|
-
*/
|
|
107
|
-
close(): void;
|
|
108
|
-
/**
|
|
109
|
-
* Send the JSON object down to the server. It will need to be stringified, base64 encoded, and then
|
|
110
|
-
* broken into chunks (since URLs have a small maximum length).
|
|
111
|
-
* @param data - The JSON data to transmit.
|
|
112
|
-
*/
|
|
113
|
-
send(data: {}): void;
|
|
114
|
-
/**
|
|
115
|
-
* This is how we notify the server that we're leaving.
|
|
116
|
-
* We aren't able to send requests with DHTML on a window close event, but we can
|
|
117
|
-
* trigger XHR requests in some browsers (everything but Opera basically).
|
|
118
|
-
*/
|
|
119
|
-
addDisconnectPingFrame(id: string, pw: string): void;
|
|
120
|
-
/**
|
|
121
|
-
* Used to track the bytes received by this client
|
|
122
|
-
*/
|
|
123
|
-
private incrementIncomingBytes_;
|
|
124
|
-
}
|
|
125
|
-
export interface IFrameElement extends HTMLIFrameElement {
|
|
126
|
-
doc: Document;
|
|
127
|
-
}
|
|
128
|
-
/*********************************************************************************************
|
|
129
|
-
* A wrapper around an iframe that is used as a long-polling script holder.
|
|
130
|
-
*********************************************************************************************/
|
|
131
|
-
export declare class FirebaseIFrameScriptHolder {
|
|
132
|
-
onDisconnect: () => void;
|
|
133
|
-
urlFn: (a: object) => string;
|
|
134
|
-
outstandingRequests: Set<number>;
|
|
135
|
-
pendingSegs: Array<{
|
|
136
|
-
seg: number;
|
|
137
|
-
ts: number;
|
|
138
|
-
d: unknown;
|
|
139
|
-
}>;
|
|
140
|
-
currentSerial: number;
|
|
141
|
-
sendNewPolls: boolean;
|
|
142
|
-
uniqueCallbackIdentifier: number;
|
|
143
|
-
myIFrame: IFrameElement;
|
|
144
|
-
alive: boolean;
|
|
145
|
-
myID: string;
|
|
146
|
-
myPW: string;
|
|
147
|
-
commandCB: (command: string, ...args: unknown[]) => void;
|
|
148
|
-
onMessageCB: (...args: unknown[]) => void;
|
|
149
|
-
/**
|
|
150
|
-
* @param commandCB - The callback to be called when control commands are received from the server.
|
|
151
|
-
* @param onMessageCB - The callback to be triggered when responses arrive from the server.
|
|
152
|
-
* @param onDisconnect - The callback to be triggered when this tag holder is closed
|
|
153
|
-
* @param urlFn - A function that provides the URL of the endpoint to send data to.
|
|
154
|
-
*/
|
|
155
|
-
constructor(commandCB: (command: string, ...args: unknown[]) => void, onMessageCB: (...args: unknown[]) => void, onDisconnect: () => void, urlFn: (a: object) => string);
|
|
156
|
-
/**
|
|
157
|
-
* Each browser has its own funny way to handle iframes. Here we mush them all together into one object that I can
|
|
158
|
-
* actually use.
|
|
159
|
-
*/
|
|
160
|
-
private static createIFrame_;
|
|
161
|
-
/**
|
|
162
|
-
* Cancel all outstanding queries and remove the frame.
|
|
163
|
-
*/
|
|
164
|
-
close(): void;
|
|
165
|
-
/**
|
|
166
|
-
* Actually start the long-polling session by adding the first script tag(s) to the iframe.
|
|
167
|
-
* @param id - The ID of this connection
|
|
168
|
-
* @param pw - The password for this connection
|
|
169
|
-
*/
|
|
170
|
-
startLongPoll(id: string, pw: string): void;
|
|
171
|
-
/**
|
|
172
|
-
* This is called any time someone might want a script tag to be added. It adds a script tag when there aren't
|
|
173
|
-
* too many outstanding requests and we are still alive.
|
|
174
|
-
*
|
|
175
|
-
* If there are outstanding packet segments to send, it sends one. If there aren't, it sends a long-poll anyways if
|
|
176
|
-
* needed.
|
|
177
|
-
*/
|
|
178
|
-
private newRequest_;
|
|
179
|
-
/**
|
|
180
|
-
* Queue a packet for transmission to the server.
|
|
181
|
-
* @param segnum - A sequential id for this packet segment used for reassembly
|
|
182
|
-
* @param totalsegs - The total number of segments in this packet
|
|
183
|
-
* @param data - The data for this segment.
|
|
184
|
-
*/
|
|
185
|
-
enqueueSegment(segnum: number, totalsegs: number, data: unknown): void;
|
|
186
|
-
/**
|
|
187
|
-
* Add a script tag for a regular long-poll request.
|
|
188
|
-
* @param url - The URL of the script tag.
|
|
189
|
-
* @param serial - The serial number of the request.
|
|
190
|
-
*/
|
|
191
|
-
private addLongPollTag_;
|
|
192
|
-
/**
|
|
193
|
-
* Add an arbitrary script tag to the iframe.
|
|
194
|
-
* @param url - The URL for the script tag source.
|
|
195
|
-
* @param loadCB - A callback to be triggered once the script has loaded.
|
|
196
|
-
*/
|
|
197
|
-
addTag(url: string, loadCB: () => void): void;
|
|
198
|
-
}
|
|
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
|
+
*/
|
|
17
|
+
import { RepoInfo } from '../core/RepoInfo';
|
|
18
|
+
import { PacketReceiver } from './polling/PacketReceiver';
|
|
19
|
+
import { Transport } from './Transport';
|
|
20
|
+
export declare const FIREBASE_LONGPOLL_START_PARAM = "start";
|
|
21
|
+
export declare const FIREBASE_LONGPOLL_CLOSE_COMMAND = "close";
|
|
22
|
+
export declare const FIREBASE_LONGPOLL_COMMAND_CB_NAME = "pLPCommand";
|
|
23
|
+
export declare const FIREBASE_LONGPOLL_DATA_CB_NAME = "pRTLPCB";
|
|
24
|
+
export declare const FIREBASE_LONGPOLL_ID_PARAM = "id";
|
|
25
|
+
export declare const FIREBASE_LONGPOLL_PW_PARAM = "pw";
|
|
26
|
+
export declare const FIREBASE_LONGPOLL_SERIAL_PARAM = "ser";
|
|
27
|
+
export declare const FIREBASE_LONGPOLL_CALLBACK_ID_PARAM = "cb";
|
|
28
|
+
export declare const FIREBASE_LONGPOLL_SEGMENT_NUM_PARAM = "seg";
|
|
29
|
+
export declare const FIREBASE_LONGPOLL_SEGMENTS_IN_PACKET = "ts";
|
|
30
|
+
export declare const FIREBASE_LONGPOLL_DATA_PARAM = "d";
|
|
31
|
+
export declare const FIREBASE_LONGPOLL_DISCONN_FRAME_PARAM = "disconn";
|
|
32
|
+
export declare const FIREBASE_LONGPOLL_DISCONN_FRAME_REQUEST_PARAM = "dframe";
|
|
33
|
+
/**
|
|
34
|
+
* This class manages a single long-polling connection.
|
|
35
|
+
*/
|
|
36
|
+
export declare class BrowserPollConnection implements Transport {
|
|
37
|
+
connId: string;
|
|
38
|
+
repoInfo: RepoInfo;
|
|
39
|
+
private applicationId?;
|
|
40
|
+
private appCheckToken?;
|
|
41
|
+
private authToken?;
|
|
42
|
+
transportSessionId?: string;
|
|
43
|
+
lastSessionId?: string;
|
|
44
|
+
bytesSent: number;
|
|
45
|
+
bytesReceived: number;
|
|
46
|
+
urlFn: (params: object) => string;
|
|
47
|
+
scriptTagHolder: FirebaseIFrameScriptHolder;
|
|
48
|
+
myDisconnFrame: HTMLIFrameElement;
|
|
49
|
+
curSegmentNum: number;
|
|
50
|
+
myPacketOrderer: PacketReceiver;
|
|
51
|
+
id: string;
|
|
52
|
+
password: string;
|
|
53
|
+
private log_;
|
|
54
|
+
private stats_;
|
|
55
|
+
private everConnected_;
|
|
56
|
+
private isClosed_;
|
|
57
|
+
private connectTimeoutTimer_;
|
|
58
|
+
private onDisconnect_;
|
|
59
|
+
/**
|
|
60
|
+
* @param connId An identifier for this connection, used for logging
|
|
61
|
+
* @param repoInfo The info for the endpoint to send data to.
|
|
62
|
+
* @param applicationId The Firebase App ID for this project.
|
|
63
|
+
* @param appCheckToken The AppCheck token for this client.
|
|
64
|
+
* @param authToken The AuthToken to use for this connection.
|
|
65
|
+
* @param transportSessionId Optional transportSessionid if we are
|
|
66
|
+
* reconnecting for an existing transport session
|
|
67
|
+
* @param lastSessionId Optional lastSessionId if the PersistentConnection has
|
|
68
|
+
* already created a connection previously
|
|
69
|
+
*/
|
|
70
|
+
constructor(connId: string, repoInfo: RepoInfo, applicationId?: string, appCheckToken?: string, authToken?: string, transportSessionId?: string, lastSessionId?: string);
|
|
71
|
+
/**
|
|
72
|
+
* @param onMessage - Callback when messages arrive
|
|
73
|
+
* @param onDisconnect - Callback with connection lost.
|
|
74
|
+
*/
|
|
75
|
+
open(onMessage: (msg: {}) => void, onDisconnect: (a?: boolean) => void): void;
|
|
76
|
+
/**
|
|
77
|
+
* Call this when a handshake has completed successfully and we want to consider the connection established
|
|
78
|
+
*/
|
|
79
|
+
start(): void;
|
|
80
|
+
static forceAllow_: boolean;
|
|
81
|
+
/**
|
|
82
|
+
* Forces long polling to be considered as a potential transport
|
|
83
|
+
*/
|
|
84
|
+
static forceAllow(): void;
|
|
85
|
+
static forceDisallow_: boolean;
|
|
86
|
+
/**
|
|
87
|
+
* Forces longpolling to not be considered as a potential transport
|
|
88
|
+
*/
|
|
89
|
+
static forceDisallow(): void;
|
|
90
|
+
static isAvailable(): boolean;
|
|
91
|
+
/**
|
|
92
|
+
* No-op for polling
|
|
93
|
+
*/
|
|
94
|
+
markConnectionHealthy(): void;
|
|
95
|
+
/**
|
|
96
|
+
* Stops polling and cleans up the iframe
|
|
97
|
+
*/
|
|
98
|
+
private shutdown_;
|
|
99
|
+
/**
|
|
100
|
+
* Triggered when this transport is closed
|
|
101
|
+
*/
|
|
102
|
+
private onClosed_;
|
|
103
|
+
/**
|
|
104
|
+
* External-facing close handler. RealTime has requested we shut down. Kill our connection and tell the server
|
|
105
|
+
* that we've left.
|
|
106
|
+
*/
|
|
107
|
+
close(): void;
|
|
108
|
+
/**
|
|
109
|
+
* Send the JSON object down to the server. It will need to be stringified, base64 encoded, and then
|
|
110
|
+
* broken into chunks (since URLs have a small maximum length).
|
|
111
|
+
* @param data - The JSON data to transmit.
|
|
112
|
+
*/
|
|
113
|
+
send(data: {}): void;
|
|
114
|
+
/**
|
|
115
|
+
* This is how we notify the server that we're leaving.
|
|
116
|
+
* We aren't able to send requests with DHTML on a window close event, but we can
|
|
117
|
+
* trigger XHR requests in some browsers (everything but Opera basically).
|
|
118
|
+
*/
|
|
119
|
+
addDisconnectPingFrame(id: string, pw: string): void;
|
|
120
|
+
/**
|
|
121
|
+
* Used to track the bytes received by this client
|
|
122
|
+
*/
|
|
123
|
+
private incrementIncomingBytes_;
|
|
124
|
+
}
|
|
125
|
+
export interface IFrameElement extends HTMLIFrameElement {
|
|
126
|
+
doc: Document;
|
|
127
|
+
}
|
|
128
|
+
/*********************************************************************************************
|
|
129
|
+
* A wrapper around an iframe that is used as a long-polling script holder.
|
|
130
|
+
*********************************************************************************************/
|
|
131
|
+
export declare class FirebaseIFrameScriptHolder {
|
|
132
|
+
onDisconnect: () => void;
|
|
133
|
+
urlFn: (a: object) => string;
|
|
134
|
+
outstandingRequests: Set<number>;
|
|
135
|
+
pendingSegs: Array<{
|
|
136
|
+
seg: number;
|
|
137
|
+
ts: number;
|
|
138
|
+
d: unknown;
|
|
139
|
+
}>;
|
|
140
|
+
currentSerial: number;
|
|
141
|
+
sendNewPolls: boolean;
|
|
142
|
+
uniqueCallbackIdentifier: number;
|
|
143
|
+
myIFrame: IFrameElement;
|
|
144
|
+
alive: boolean;
|
|
145
|
+
myID: string;
|
|
146
|
+
myPW: string;
|
|
147
|
+
commandCB: (command: string, ...args: unknown[]) => void;
|
|
148
|
+
onMessageCB: (...args: unknown[]) => void;
|
|
149
|
+
/**
|
|
150
|
+
* @param commandCB - The callback to be called when control commands are received from the server.
|
|
151
|
+
* @param onMessageCB - The callback to be triggered when responses arrive from the server.
|
|
152
|
+
* @param onDisconnect - The callback to be triggered when this tag holder is closed
|
|
153
|
+
* @param urlFn - A function that provides the URL of the endpoint to send data to.
|
|
154
|
+
*/
|
|
155
|
+
constructor(commandCB: (command: string, ...args: unknown[]) => void, onMessageCB: (...args: unknown[]) => void, onDisconnect: () => void, urlFn: (a: object) => string);
|
|
156
|
+
/**
|
|
157
|
+
* Each browser has its own funny way to handle iframes. Here we mush them all together into one object that I can
|
|
158
|
+
* actually use.
|
|
159
|
+
*/
|
|
160
|
+
private static createIFrame_;
|
|
161
|
+
/**
|
|
162
|
+
* Cancel all outstanding queries and remove the frame.
|
|
163
|
+
*/
|
|
164
|
+
close(): void;
|
|
165
|
+
/**
|
|
166
|
+
* Actually start the long-polling session by adding the first script tag(s) to the iframe.
|
|
167
|
+
* @param id - The ID of this connection
|
|
168
|
+
* @param pw - The password for this connection
|
|
169
|
+
*/
|
|
170
|
+
startLongPoll(id: string, pw: string): void;
|
|
171
|
+
/**
|
|
172
|
+
* This is called any time someone might want a script tag to be added. It adds a script tag when there aren't
|
|
173
|
+
* too many outstanding requests and we are still alive.
|
|
174
|
+
*
|
|
175
|
+
* If there are outstanding packet segments to send, it sends one. If there aren't, it sends a long-poll anyways if
|
|
176
|
+
* needed.
|
|
177
|
+
*/
|
|
178
|
+
private newRequest_;
|
|
179
|
+
/**
|
|
180
|
+
* Queue a packet for transmission to the server.
|
|
181
|
+
* @param segnum - A sequential id for this packet segment used for reassembly
|
|
182
|
+
* @param totalsegs - The total number of segments in this packet
|
|
183
|
+
* @param data - The data for this segment.
|
|
184
|
+
*/
|
|
185
|
+
enqueueSegment(segnum: number, totalsegs: number, data: unknown): void;
|
|
186
|
+
/**
|
|
187
|
+
* Add a script tag for a regular long-poll request.
|
|
188
|
+
* @param url - The URL of the script tag.
|
|
189
|
+
* @param serial - The serial number of the request.
|
|
190
|
+
*/
|
|
191
|
+
private addLongPollTag_;
|
|
192
|
+
/**
|
|
193
|
+
* Add an arbitrary script tag to the iframe.
|
|
194
|
+
* @param url - The URL for the script tag source.
|
|
195
|
+
* @param loadCB - A callback to be triggered once the script has loaded.
|
|
196
|
+
*/
|
|
197
|
+
addTag(url: string, loadCB: () => void): void;
|
|
198
|
+
}
|
|
@@ -1,102 +1,102 @@
|
|
|
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
|
-
*/
|
|
17
|
-
import { RepoInfo } from '../core/RepoInfo';
|
|
18
|
-
/**
|
|
19
|
-
* Creates a new real-time connection to the server using whichever method works
|
|
20
|
-
* best in the current browser.
|
|
21
|
-
*/
|
|
22
|
-
export declare class Connection {
|
|
23
|
-
id: string;
|
|
24
|
-
private repoInfo_;
|
|
25
|
-
private applicationId_;
|
|
26
|
-
private appCheckToken_;
|
|
27
|
-
private authToken_;
|
|
28
|
-
private onMessage_;
|
|
29
|
-
private onReady_;
|
|
30
|
-
private onDisconnect_;
|
|
31
|
-
private onKill_;
|
|
32
|
-
lastSessionId?: string;
|
|
33
|
-
connectionCount: number;
|
|
34
|
-
pendingDataMessages: unknown[];
|
|
35
|
-
sessionId: string;
|
|
36
|
-
private conn_;
|
|
37
|
-
private healthyTimeout_;
|
|
38
|
-
private isHealthy_;
|
|
39
|
-
private log_;
|
|
40
|
-
private primaryResponsesRequired_;
|
|
41
|
-
private rx_;
|
|
42
|
-
private secondaryConn_;
|
|
43
|
-
private secondaryResponsesRequired_;
|
|
44
|
-
private state_;
|
|
45
|
-
private transportManager_;
|
|
46
|
-
private tx_;
|
|
47
|
-
/**
|
|
48
|
-
* @param id - an id for this connection
|
|
49
|
-
* @param repoInfo_ - the info for the endpoint to connect to
|
|
50
|
-
* @param applicationId_ - the Firebase App ID for this project
|
|
51
|
-
* @param appCheckToken_ - The App Check Token for this device.
|
|
52
|
-
* @param authToken_ - The auth token for this session.
|
|
53
|
-
* @param onMessage_ - the callback to be triggered when a server-push message arrives
|
|
54
|
-
* @param onReady_ - the callback to be triggered when this connection is ready to send messages.
|
|
55
|
-
* @param onDisconnect_ - the callback to be triggered when a connection was lost
|
|
56
|
-
* @param onKill_ - the callback to be triggered when this connection has permanently shut down.
|
|
57
|
-
* @param lastSessionId - last session id in persistent connection. is used to clean up old session in real-time server
|
|
58
|
-
*/
|
|
59
|
-
constructor(id: string, repoInfo_: RepoInfo, applicationId_: string | undefined, appCheckToken_: string | undefined, authToken_: string | undefined, onMessage_: (a: {}) => void, onReady_: (a: number, b: string) => void, onDisconnect_: () => void, onKill_: (a: string) => void, lastSessionId?: string);
|
|
60
|
-
/**
|
|
61
|
-
* Starts a connection attempt
|
|
62
|
-
*/
|
|
63
|
-
private start_;
|
|
64
|
-
private nextTransportId_;
|
|
65
|
-
private disconnReceiver_;
|
|
66
|
-
private connReceiver_;
|
|
67
|
-
/**
|
|
68
|
-
* @param dataMsg - An arbitrary data message to be sent to the server
|
|
69
|
-
*/
|
|
70
|
-
sendRequest(dataMsg: object): void;
|
|
71
|
-
tryCleanupConnection(): void;
|
|
72
|
-
private onSecondaryControl_;
|
|
73
|
-
private onSecondaryMessageReceived_;
|
|
74
|
-
private upgradeIfSecondaryHealthy_;
|
|
75
|
-
private proceedWithUpgrade_;
|
|
76
|
-
private onPrimaryMessageReceived_;
|
|
77
|
-
private onDataMessage_;
|
|
78
|
-
private onPrimaryResponse_;
|
|
79
|
-
private onControl_;
|
|
80
|
-
/**
|
|
81
|
-
* @param handshake - The handshake data returned from the server
|
|
82
|
-
*/
|
|
83
|
-
private onHandshake_;
|
|
84
|
-
private tryStartUpgrade_;
|
|
85
|
-
private startUpgrade_;
|
|
86
|
-
private onReset_;
|
|
87
|
-
private onConnectionEstablished_;
|
|
88
|
-
private sendPingOnPrimaryIfNecessary_;
|
|
89
|
-
private onSecondaryConnectionLost_;
|
|
90
|
-
/**
|
|
91
|
-
* @param everConnected - Whether or not the connection ever reached a server. Used to determine if
|
|
92
|
-
* we should flush the host cache
|
|
93
|
-
*/
|
|
94
|
-
private onConnectionLost_;
|
|
95
|
-
private onConnectionShutdown_;
|
|
96
|
-
private sendData_;
|
|
97
|
-
/**
|
|
98
|
-
* Cleans up this connection, calling the appropriate callbacks
|
|
99
|
-
*/
|
|
100
|
-
close(): void;
|
|
101
|
-
private closeConnections_;
|
|
102
|
-
}
|
|
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
|
+
*/
|
|
17
|
+
import { RepoInfo } from '../core/RepoInfo';
|
|
18
|
+
/**
|
|
19
|
+
* Creates a new real-time connection to the server using whichever method works
|
|
20
|
+
* best in the current browser.
|
|
21
|
+
*/
|
|
22
|
+
export declare class Connection {
|
|
23
|
+
id: string;
|
|
24
|
+
private repoInfo_;
|
|
25
|
+
private applicationId_;
|
|
26
|
+
private appCheckToken_;
|
|
27
|
+
private authToken_;
|
|
28
|
+
private onMessage_;
|
|
29
|
+
private onReady_;
|
|
30
|
+
private onDisconnect_;
|
|
31
|
+
private onKill_;
|
|
32
|
+
lastSessionId?: string;
|
|
33
|
+
connectionCount: number;
|
|
34
|
+
pendingDataMessages: unknown[];
|
|
35
|
+
sessionId: string;
|
|
36
|
+
private conn_;
|
|
37
|
+
private healthyTimeout_;
|
|
38
|
+
private isHealthy_;
|
|
39
|
+
private log_;
|
|
40
|
+
private primaryResponsesRequired_;
|
|
41
|
+
private rx_;
|
|
42
|
+
private secondaryConn_;
|
|
43
|
+
private secondaryResponsesRequired_;
|
|
44
|
+
private state_;
|
|
45
|
+
private transportManager_;
|
|
46
|
+
private tx_;
|
|
47
|
+
/**
|
|
48
|
+
* @param id - an id for this connection
|
|
49
|
+
* @param repoInfo_ - the info for the endpoint to connect to
|
|
50
|
+
* @param applicationId_ - the Firebase App ID for this project
|
|
51
|
+
* @param appCheckToken_ - The App Check Token for this device.
|
|
52
|
+
* @param authToken_ - The auth token for this session.
|
|
53
|
+
* @param onMessage_ - the callback to be triggered when a server-push message arrives
|
|
54
|
+
* @param onReady_ - the callback to be triggered when this connection is ready to send messages.
|
|
55
|
+
* @param onDisconnect_ - the callback to be triggered when a connection was lost
|
|
56
|
+
* @param onKill_ - the callback to be triggered when this connection has permanently shut down.
|
|
57
|
+
* @param lastSessionId - last session id in persistent connection. is used to clean up old session in real-time server
|
|
58
|
+
*/
|
|
59
|
+
constructor(id: string, repoInfo_: RepoInfo, applicationId_: string | undefined, appCheckToken_: string | undefined, authToken_: string | undefined, onMessage_: (a: {}) => void, onReady_: (a: number, b: string) => void, onDisconnect_: () => void, onKill_: (a: string) => void, lastSessionId?: string);
|
|
60
|
+
/**
|
|
61
|
+
* Starts a connection attempt
|
|
62
|
+
*/
|
|
63
|
+
private start_;
|
|
64
|
+
private nextTransportId_;
|
|
65
|
+
private disconnReceiver_;
|
|
66
|
+
private connReceiver_;
|
|
67
|
+
/**
|
|
68
|
+
* @param dataMsg - An arbitrary data message to be sent to the server
|
|
69
|
+
*/
|
|
70
|
+
sendRequest(dataMsg: object): void;
|
|
71
|
+
tryCleanupConnection(): void;
|
|
72
|
+
private onSecondaryControl_;
|
|
73
|
+
private onSecondaryMessageReceived_;
|
|
74
|
+
private upgradeIfSecondaryHealthy_;
|
|
75
|
+
private proceedWithUpgrade_;
|
|
76
|
+
private onPrimaryMessageReceived_;
|
|
77
|
+
private onDataMessage_;
|
|
78
|
+
private onPrimaryResponse_;
|
|
79
|
+
private onControl_;
|
|
80
|
+
/**
|
|
81
|
+
* @param handshake - The handshake data returned from the server
|
|
82
|
+
*/
|
|
83
|
+
private onHandshake_;
|
|
84
|
+
private tryStartUpgrade_;
|
|
85
|
+
private startUpgrade_;
|
|
86
|
+
private onReset_;
|
|
87
|
+
private onConnectionEstablished_;
|
|
88
|
+
private sendPingOnPrimaryIfNecessary_;
|
|
89
|
+
private onSecondaryConnectionLost_;
|
|
90
|
+
/**
|
|
91
|
+
* @param everConnected - Whether or not the connection ever reached a server. Used to determine if
|
|
92
|
+
* we should flush the host cache
|
|
93
|
+
*/
|
|
94
|
+
private onConnectionLost_;
|
|
95
|
+
private onConnectionShutdown_;
|
|
96
|
+
private sendData_;
|
|
97
|
+
/**
|
|
98
|
+
* Cleans up this connection, calling the appropriate callbacks
|
|
99
|
+
*/
|
|
100
|
+
close(): void;
|
|
101
|
+
private closeConnections_;
|
|
102
|
+
}
|
|
@@ -1,27 +1,27 @@
|
|
|
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
|
-
*/
|
|
17
|
-
export declare const PROTOCOL_VERSION = "5";
|
|
18
|
-
export declare const VERSION_PARAM = "v";
|
|
19
|
-
export declare const TRANSPORT_SESSION_PARAM = "s";
|
|
20
|
-
export declare const REFERER_PARAM = "r";
|
|
21
|
-
export declare const FORGE_REF = "f";
|
|
22
|
-
export declare const FORGE_DOMAIN_RE: RegExp;
|
|
23
|
-
export declare const LAST_SESSION_PARAM = "ls";
|
|
24
|
-
export declare const APPLICATION_ID_PARAM = "p";
|
|
25
|
-
export declare const APP_CHECK_TOKEN_PARAM = "ac";
|
|
26
|
-
export declare const WEBSOCKET = "websocket";
|
|
27
|
-
export declare const LONG_POLLING = "long_polling";
|
|
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
|
+
*/
|
|
17
|
+
export declare const PROTOCOL_VERSION = "5";
|
|
18
|
+
export declare const VERSION_PARAM = "v";
|
|
19
|
+
export declare const TRANSPORT_SESSION_PARAM = "s";
|
|
20
|
+
export declare const REFERER_PARAM = "r";
|
|
21
|
+
export declare const FORGE_REF = "f";
|
|
22
|
+
export declare const FORGE_DOMAIN_RE: RegExp;
|
|
23
|
+
export declare const LAST_SESSION_PARAM = "ls";
|
|
24
|
+
export declare const APPLICATION_ID_PARAM = "p";
|
|
25
|
+
export declare const APP_CHECK_TOKEN_PARAM = "ac";
|
|
26
|
+
export declare const WEBSOCKET = "websocket";
|
|
27
|
+
export declare const LONG_POLLING = "long_polling";
|