@firebase/data-connect 0.7.2 → 0.7.3
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 +8 -15
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +8 -15
- package/dist/index.esm.js.map +1 -1
- package/dist/index.node.cjs.js +8 -15
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/node-esm/index.node.esm.js +8 -15
- package/dist/node-esm/index.node.esm.js.map +1 -1
- package/dist/node-esm/src/network/stream/wire.d.ts +1 -0
- package/dist/src/network/stream/wire.d.ts +1 -0
- package/package.json +1 -1
|
@@ -308,7 +308,8 @@ async function dcFetch(url, body, { signal }, appId, accessToken, appCheckToken,
|
|
|
308
308
|
}
|
|
309
309
|
const headers = {
|
|
310
310
|
'Content-Type': 'application/json',
|
|
311
|
-
'X-Goog-Api-Client': getGoogApiClientValue(_isUsingGen, _callerSdkType)
|
|
311
|
+
'X-Goog-Api-Client': getGoogApiClientValue(_isUsingGen, _callerSdkType),
|
|
312
|
+
'X-Client-Version': `web/${SDK_VERSION}`
|
|
312
313
|
};
|
|
313
314
|
if (accessToken) {
|
|
314
315
|
headers['X-Firebase-Auth-Token'] = accessToken;
|
|
@@ -527,13 +528,9 @@ const IDLE_CONNECTION_TIMEOUT_MS = 15 * 1000; // 15 seconds
|
|
|
527
528
|
/** Initial reconnect delay in ms */
|
|
528
529
|
const INITIAL_RECONNECT_DELAY_MS = 1000; // 1 second
|
|
529
530
|
/** Max reconnect delay in ms */
|
|
530
|
-
const MAX_RECONNECT_DELAY_MS =
|
|
531
|
-
/** Max random jitter to add to reconnect delay in ms */
|
|
532
|
-
const MAX_RECONNECT_JITTER_MS = 0.5 * 1000; // 0.5 seconds
|
|
531
|
+
const MAX_RECONNECT_DELAY_MS = 60 * 1000; // 60 seconds
|
|
533
532
|
/** Factor to multiply delay by on failure */
|
|
534
|
-
const RECONNECT_BACKOFF_FACTOR = 1.
|
|
535
|
-
/** Max number of reconnection attempts before giving up */
|
|
536
|
-
const MAX_RECONNECT_ATTEMPTS = 10;
|
|
533
|
+
const RECONNECT_BACKOFF_FACTOR = 1.5;
|
|
537
534
|
/**
|
|
538
535
|
* The base class for all Stream Transport implementations.
|
|
539
536
|
* Handles management of logical streams (requests), authentication, data routing to query layer,
|
|
@@ -785,15 +782,10 @@ class AbstractDataConnectStreamTransport extends AbstractDataConnectTransport {
|
|
|
785
782
|
if (this.reconnectTimer) {
|
|
786
783
|
return;
|
|
787
784
|
}
|
|
788
|
-
|
|
789
|
-
const errorString = 'Stream disconnected and could not reconnect - max stream reconnection attempts reached.';
|
|
790
|
-
logError(errorString);
|
|
791
|
-
void this.cleanupAndTerminate(Code.OTHER, errorString);
|
|
792
|
-
return;
|
|
793
|
-
}
|
|
785
|
+
this.reconnectAttempts++;
|
|
794
786
|
const delay = this.reconnectDelayMs;
|
|
795
787
|
this.reconnectDelayMs = Math.min(this.reconnectDelayMs * RECONNECT_BACKOFF_FACTOR, MAX_RECONNECT_DELAY_MS);
|
|
796
|
-
const jitter = Math.random() *
|
|
788
|
+
const jitter = (Math.random() - 0.5) * delay;
|
|
797
789
|
this.reconnectTimer = setTimeout(() => {
|
|
798
790
|
this.reconnectTimer = null;
|
|
799
791
|
void this.attemptReconnect();
|
|
@@ -955,6 +947,7 @@ class AbstractDataConnectStreamTransport extends AbstractDataConnectTransport {
|
|
|
955
947
|
this.lastSentAuthToken = this._authToken;
|
|
956
948
|
}
|
|
957
949
|
if (this.isFirstStreamMessage) {
|
|
950
|
+
headers['X-Client-Version'] = `web/${SDK_VERSION}`;
|
|
958
951
|
if (this._appCheckToken) {
|
|
959
952
|
headers['X-Firebase-App-Check'] = this._appCheckToken;
|
|
960
953
|
}
|
|
@@ -1557,7 +1550,7 @@ class WebSocketTransport extends AbstractDataConnectStreamTransport {
|
|
|
1557
1550
|
}
|
|
1558
1551
|
|
|
1559
1552
|
const name = "@firebase/data-connect";
|
|
1560
|
-
const version = "0.7.
|
|
1553
|
+
const version = "0.7.3";
|
|
1561
1554
|
|
|
1562
1555
|
/**
|
|
1563
1556
|
* @license
|