@genesislcap/foundation-comms 15.86.0-GENC-0.5 → 15.86.1-FUI-2666.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.
|
@@ -170,6 +170,17 @@ export declare class DefaultSocket implements Socket {
|
|
|
170
170
|
private connectOptions;
|
|
171
171
|
private reconnectOptions;
|
|
172
172
|
private socketSubscription;
|
|
173
|
+
/**
|
|
174
|
+
* `suspended` after freeze/bfcache until recovery runs; `recovered` until `pageshow` (or a plain
|
|
175
|
+
* `resume` with no `pageshow`) returns to `idle`, so `resume` + `pageshow` don't recover twice.
|
|
176
|
+
*/
|
|
177
|
+
private pageLifecycle;
|
|
178
|
+
private removePageLifecycleListeners?;
|
|
179
|
+
/**
|
|
180
|
+
* Set when recovering while a reconnect loop is mid-flight so the next `connect()` clears
|
|
181
|
+
* handlers even if `reconnectStreams` would otherwise keep them (stale DATASERVER logons).
|
|
182
|
+
*/
|
|
183
|
+
private forceCleanMessagesOnNextConnect;
|
|
173
184
|
private attempt?;
|
|
174
185
|
private reconnectLoop?;
|
|
175
186
|
private reconnectOutcome?;
|
|
@@ -185,6 +196,18 @@ export declare class DefaultSocket implements Socket {
|
|
|
185
196
|
* Temp putting the user in place to bridge the hasValidSession logic.
|
|
186
197
|
*/
|
|
187
198
|
user: User, config: ConnectConfig);
|
|
199
|
+
/**
|
|
200
|
+
* Chrome terminates WebSockets when a tab is frozen or put in the back-forward cache.
|
|
201
|
+
* On restore, call `connect()` so datasources see the tested false→true path (#2718/#2720)
|
|
202
|
+
* instead of replaying stale DATASERVER logons on a dead transport.
|
|
203
|
+
*
|
|
204
|
+
* Note: `networkMonitor` also listens to `pageshow` / `visibilitychange` and may re-logon
|
|
205
|
+
* unhealthy resources. Socket-level recovery clears handlers and reconnects; both can run on
|
|
206
|
+
* the same `pageshow`. Prefer this path for bfcache/freeze (transport is often dead);
|
|
207
|
+
* networkMonitor covers soft disconnects while the tab stays alive.
|
|
208
|
+
*/
|
|
209
|
+
private ensurePageLifecycleListeners;
|
|
210
|
+
private recoverAfterPageLifecycle;
|
|
188
211
|
/** Makes SCDB columnar payloads transparent (no-op unless an encoding was negotiated). */
|
|
189
212
|
private get scdbDecoder();
|
|
190
213
|
private get heartbeatLoggingIsEnabled();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"socket.d.ts","sourceRoot":"","sources":["../../../src/connect/socket.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,8BAA8B,CAAC;AACpD,OAAO,EAAsB,cAAc,EAAE,IAAI,EAAE,MAAM,+BAA+B,CAAC;AAGzF,OAAO,EAAQ,UAAU,EAAgB,OAAO,EAAE,YAAY,EAAc,MAAM,MAAM,CAAC;AAKzF,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAIrC,OAAO,EAAE,aAAa,EAAE,KAAK,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAE5E,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAEL,OAAO,EACP,cAAc,EAIf,MAAM,WAAW,CAAC;AACnB,OAAO,EAKL,sBAAsB,EAEvB,MAAM,qBAAqB,CAAC;AAS7B,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAG3D;;;;GAIG;AACH,qBAAa,aAAa,CAAC,CAAC,CAAE,SAAQ,OAAO,CAAC,CAAC,CAAC;;CAI/C;AAED;;;;GAIG;AACH,qBAAa,gBAAgB,CAAC,CAAC,CAAE,SAAQ,UAAU,CAAC,CAAC,CAAC;gBACxC,GAAG,IAAI,EAAE,GAAG,EAAE;CAG3B;AAED;;;GAGG;AACH,OAAO,EAAE,YAAY,IAAI,kBAAkB,EAAE,CAAC;AAE9C;;;GAGG;AACH,qBAAa,oBAAoB;gBACnB,OAAO,EAAE,OAAO,EAAE,SAAS,EA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,CAAC,CAAC,GAAG,GAAG,CAAC,EACzB,SAAS,EAAE,QAAQ,EACnB,OAAO,EAAE,QAAQ,GAChB,UAAU,CAAC,OAAO,CAAC;IAef,cAAc,QAAO,aAAa,CAAC,OAAO,CAAC,CAAoB;IAEtE,OAAO,CAAC,iBAAiB;IAezB,OAAO,CAAC,cAAc;IAOtB,OAAO,CAAC,oBAAoB;IAI5B;;;OAGG;IACH,wBAAwB,CAAC,SAAS,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,IAAI;IAI5F;;;;;;OAMG;IACH,OAAO,CAAC,cAAc;IAQtB,OAAO,CAAC,iBAAiB;IAUzB,OAAO,CAAC,kBAAkB;CAkB3B;AAED;;;GAGG;AACH,eAAO,MAAM,MAAM,8DAAgE,CAAC;AAEpF;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,SAAS,IAAI,MAAM,CAElC"}
|
|
@@ -152,6 +152,16 @@ let DefaultSocket = class DefaultSocket {
|
|
|
152
152
|
this.scdbWasmRequested = false;
|
|
153
153
|
this.heartbeatIsEnabled = true;
|
|
154
154
|
this.heartbeatInterval = this.defaultInterval;
|
|
155
|
+
/**
|
|
156
|
+
* `suspended` after freeze/bfcache until recovery runs; `recovered` until `pageshow` (or a plain
|
|
157
|
+
* `resume` with no `pageshow`) returns to `idle`, so `resume` + `pageshow` don't recover twice.
|
|
158
|
+
*/
|
|
159
|
+
this.pageLifecycle = 'idle';
|
|
160
|
+
/**
|
|
161
|
+
* Set when recovering while a reconnect loop is mid-flight so the next `connect()` clears
|
|
162
|
+
* handlers even if `reconnectStreams` would otherwise keep them (stale DATASERVER logons).
|
|
163
|
+
*/
|
|
164
|
+
this.forceCleanMessagesOnNextConnect = false;
|
|
155
165
|
/** Counts logins and logouts, and their count when the latest attempt began. */
|
|
156
166
|
this.authChanges = 0;
|
|
157
167
|
this.attemptAuthChanges = 0;
|
|
@@ -160,6 +170,76 @@ let DefaultSocket = class DefaultSocket {
|
|
|
160
170
|
this.authChanges += 1;
|
|
161
171
|
});
|
|
162
172
|
}
|
|
173
|
+
/**
|
|
174
|
+
* Chrome terminates WebSockets when a tab is frozen or put in the back-forward cache.
|
|
175
|
+
* On restore, call `connect()` so datasources see the tested false→true path (#2718/#2720)
|
|
176
|
+
* instead of replaying stale DATASERVER logons on a dead transport.
|
|
177
|
+
*
|
|
178
|
+
* Note: `networkMonitor` also listens to `pageshow` / `visibilitychange` and may re-logon
|
|
179
|
+
* unhealthy resources. Socket-level recovery clears handlers and reconnects; both can run on
|
|
180
|
+
* the same `pageshow`. Prefer this path for bfcache/freeze (transport is often dead);
|
|
181
|
+
* networkMonitor covers soft disconnects while the tab stays alive.
|
|
182
|
+
*/
|
|
183
|
+
ensurePageLifecycleListeners() {
|
|
184
|
+
if (this.removePageLifecycleListeners ||
|
|
185
|
+
typeof window === 'undefined' ||
|
|
186
|
+
typeof document === 'undefined') {
|
|
187
|
+
return;
|
|
188
|
+
}
|
|
189
|
+
const markSuspended = () => {
|
|
190
|
+
this.pageLifecycle = 'suspended';
|
|
191
|
+
};
|
|
192
|
+
const onResume = () => {
|
|
193
|
+
this.recoverAfterPageLifecycle();
|
|
194
|
+
// Plain freeze→resume has no pageshow; release the gate so a later bfcache can arm.
|
|
195
|
+
if (this.pageLifecycle === 'recovered') {
|
|
196
|
+
this.pageLifecycle = 'idle';
|
|
197
|
+
}
|
|
198
|
+
};
|
|
199
|
+
const onPageHide = (event) => {
|
|
200
|
+
if (event.persisted) {
|
|
201
|
+
markSuspended();
|
|
202
|
+
}
|
|
203
|
+
};
|
|
204
|
+
const onPageShow = (event) => {
|
|
205
|
+
// bfcache restore may omit pagehide(persisted); arm only if resume hasn't already recovered.
|
|
206
|
+
if (event.persisted && this.pageLifecycle === 'idle') {
|
|
207
|
+
this.pageLifecycle = 'suspended';
|
|
208
|
+
}
|
|
209
|
+
this.recoverAfterPageLifecycle();
|
|
210
|
+
this.pageLifecycle = 'idle';
|
|
211
|
+
};
|
|
212
|
+
document.addEventListener('freeze', markSuspended);
|
|
213
|
+
document.addEventListener('resume', onResume);
|
|
214
|
+
window.addEventListener('pagehide', onPageHide);
|
|
215
|
+
window.addEventListener('pageshow', onPageShow);
|
|
216
|
+
this.removePageLifecycleListeners = () => {
|
|
217
|
+
document.removeEventListener('freeze', markSuspended);
|
|
218
|
+
document.removeEventListener('resume', onResume);
|
|
219
|
+
window.removeEventListener('pagehide', onPageHide);
|
|
220
|
+
window.removeEventListener('pageshow', onPageShow);
|
|
221
|
+
};
|
|
222
|
+
}
|
|
223
|
+
recoverAfterPageLifecycle() {
|
|
224
|
+
var _a;
|
|
225
|
+
if (this.pageLifecycle !== 'suspended') {
|
|
226
|
+
return;
|
|
227
|
+
}
|
|
228
|
+
this.pageLifecycle = 'recovered';
|
|
229
|
+
if (!this.url) {
|
|
230
|
+
return;
|
|
231
|
+
}
|
|
232
|
+
// A mid-flight reconnect loop would skip cleanMessages when reconnectStreams is on and
|
|
233
|
+
// replay old DATASERVER logons. Cancel it and force a clean connect.
|
|
234
|
+
if (this.isReconnecting) {
|
|
235
|
+
this.forceCleanMessagesOnNextConnect = true;
|
|
236
|
+
(_a = this.reconnectLoop) === null || _a === void 0 ? void 0 : _a.unsubscribe();
|
|
237
|
+
this.reconnectLoop = undefined;
|
|
238
|
+
this.reconnectOutcome = undefined;
|
|
239
|
+
this.status.isReconnecting = false;
|
|
240
|
+
}
|
|
241
|
+
void this.connect(this.url, this.connectOptions, this.reconnectOptions);
|
|
242
|
+
}
|
|
163
243
|
/** Makes SCDB columnar payloads transparent (no-op unless an encoding was negotiated). */
|
|
164
244
|
get scdbDecoder() {
|
|
165
245
|
var _a;
|
|
@@ -188,6 +268,8 @@ let DefaultSocket = class DefaultSocket {
|
|
|
188
268
|
logger.warn(`Make sure the host url starts with wss:// or ws://`);
|
|
189
269
|
return;
|
|
190
270
|
}
|
|
271
|
+
// After the host check so a rejected invalid URL does not arm freeze/resume recovery.
|
|
272
|
+
this.ensurePageLifecycleListeners();
|
|
191
273
|
this.attemptAuthChanges = this.authChanges;
|
|
192
274
|
const replacingLiveSocket = !!this.websocket && this.isConnected;
|
|
193
275
|
const connection = new Promise((resolve) => {
|
|
@@ -195,7 +277,10 @@ let DefaultSocket = class DefaultSocket {
|
|
|
195
277
|
logger.info(`${this.isReconnecting ? 'Reconnecting' : 'Connecting'} to ${this.url}`);
|
|
196
278
|
this.status.isConnecting = !this.isReconnecting;
|
|
197
279
|
this.rejectPendingRequests();
|
|
198
|
-
const cleanMessages =
|
|
280
|
+
const cleanMessages = this.forceCleanMessagesOnNextConnect ||
|
|
281
|
+
!this.isReconnecting ||
|
|
282
|
+
!((_a = this.reconnectOptions) === null || _a === void 0 ? void 0 : _a.reconnectStreams);
|
|
283
|
+
this.forceCleanMessagesOnNextConnect = false;
|
|
199
284
|
if (cleanMessages) {
|
|
200
285
|
this.cleanMessages();
|
|
201
286
|
}
|
|
@@ -535,14 +620,19 @@ let DefaultSocket = class DefaultSocket {
|
|
|
535
620
|
window.location.reload();
|
|
536
621
|
}
|
|
537
622
|
reset() {
|
|
538
|
-
var _a, _b;
|
|
623
|
+
var _a, _b, _c;
|
|
624
|
+
// Drop global listeners first so a failing complete() cannot leak freeze/resume handlers.
|
|
625
|
+
(_a = this.removePageLifecycleListeners) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
626
|
+
this.removePageLifecycleListeners = undefined;
|
|
627
|
+
this.pageLifecycle = 'idle';
|
|
628
|
+
this.forceCleanMessagesOnNextConnect = false;
|
|
539
629
|
this.status.isConnected = false;
|
|
540
630
|
this.status.isConfigured = false;
|
|
541
631
|
this.status.isReconnecting = false;
|
|
542
632
|
// A running loop's next attempt would replace whichever socket follows this reset.
|
|
543
|
-
(
|
|
633
|
+
(_b = this.reconnectLoop) === null || _b === void 0 ? void 0 : _b.unsubscribe();
|
|
544
634
|
// Closes a socket still connecting too, which completing the subject alone does not.
|
|
545
|
-
(
|
|
635
|
+
(_c = this.socketSubscription) === null || _c === void 0 ? void 0 : _c.unsubscribe();
|
|
546
636
|
this.websocket && this.websocket.complete();
|
|
547
637
|
this.websocket = null;
|
|
548
638
|
this.attempt = undefined;
|
|
@@ -2954,6 +2954,17 @@ export declare class DefaultSocket implements Socket {
|
|
|
2954
2954
|
private connectOptions;
|
|
2955
2955
|
private reconnectOptions;
|
|
2956
2956
|
private socketSubscription;
|
|
2957
|
+
/**
|
|
2958
|
+
* `suspended` after freeze/bfcache until recovery runs; `recovered` until `pageshow` (or a plain
|
|
2959
|
+
* `resume` with no `pageshow`) returns to `idle`, so `resume` + `pageshow` don't recover twice.
|
|
2960
|
+
*/
|
|
2961
|
+
private pageLifecycle;
|
|
2962
|
+
private removePageLifecycleListeners?;
|
|
2963
|
+
/**
|
|
2964
|
+
* Set when recovering while a reconnect loop is mid-flight so the next `connect()` clears
|
|
2965
|
+
* handlers even if `reconnectStreams` would otherwise keep them (stale DATASERVER logons).
|
|
2966
|
+
*/
|
|
2967
|
+
private forceCleanMessagesOnNextConnect;
|
|
2957
2968
|
private attempt?;
|
|
2958
2969
|
private reconnectLoop?;
|
|
2959
2970
|
private reconnectOutcome?;
|
|
@@ -2969,6 +2980,18 @@ export declare class DefaultSocket implements Socket {
|
|
|
2969
2980
|
* Temp putting the user in place to bridge the hasValidSession logic.
|
|
2970
2981
|
*/
|
|
2971
2982
|
user: User_2, config: ConnectConfig);
|
|
2983
|
+
/**
|
|
2984
|
+
* Chrome terminates WebSockets when a tab is frozen or put in the back-forward cache.
|
|
2985
|
+
* On restore, call `connect()` so datasources see the tested false→true path (#2718/#2720)
|
|
2986
|
+
* instead of replaying stale DATASERVER logons on a dead transport.
|
|
2987
|
+
*
|
|
2988
|
+
* Note: `networkMonitor` also listens to `pageshow` / `visibilitychange` and may re-logon
|
|
2989
|
+
* unhealthy resources. Socket-level recovery clears handlers and reconnects; both can run on
|
|
2990
|
+
* the same `pageshow`. Prefer this path for bfcache/freeze (transport is often dead);
|
|
2991
|
+
* networkMonitor covers soft disconnects while the tab stays alive.
|
|
2992
|
+
*/
|
|
2993
|
+
private ensurePageLifecycleListeners;
|
|
2994
|
+
private recoverAfterPageLifecycle;
|
|
2972
2995
|
/** Makes SCDB columnar payloads transparent (no-op unless an encoding was negotiated). */
|
|
2973
2996
|
private get scdbDecoder();
|
|
2974
2997
|
private get heartbeatLoggingIsEnabled();
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@genesislcap/foundation-comms",
|
|
3
3
|
"description": "Genesis Foundation UI Comms",
|
|
4
|
-
"version": "15.86.
|
|
4
|
+
"version": "15.86.1-FUI-2666.3",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"license": "SEE LICENSE IN license.txt",
|
|
7
7
|
"main": "dist/esm/index.js",
|
|
@@ -75,12 +75,12 @@
|
|
|
75
75
|
}
|
|
76
76
|
},
|
|
77
77
|
"devDependencies": {
|
|
78
|
-
"@genesislcap/foundation-testing": "15.86.
|
|
79
|
-
"@genesislcap/genx": "15.86.
|
|
80
|
-
"@genesislcap/ts-builder": "15.86.
|
|
81
|
-
"@genesislcap/uvu-playwright-builder": "15.86.
|
|
82
|
-
"@genesislcap/vite-builder": "15.86.
|
|
83
|
-
"@genesislcap/webpack-builder": "15.86.
|
|
78
|
+
"@genesislcap/foundation-testing": "15.86.1-FUI-2666.3",
|
|
79
|
+
"@genesislcap/genx": "15.86.1-FUI-2666.3",
|
|
80
|
+
"@genesislcap/ts-builder": "15.86.1-FUI-2666.3",
|
|
81
|
+
"@genesislcap/uvu-playwright-builder": "15.86.1-FUI-2666.3",
|
|
82
|
+
"@genesislcap/vite-builder": "15.86.1-FUI-2666.3",
|
|
83
|
+
"@genesislcap/webpack-builder": "15.86.1-FUI-2666.3",
|
|
84
84
|
"@types/js-cookie": "^3.0.2",
|
|
85
85
|
"@types/json-schema": "^7.0.11",
|
|
86
86
|
"@types/webappsec-credential-management": "^0.6.2",
|
|
@@ -88,11 +88,11 @@
|
|
|
88
88
|
"sinon": "^17.0.1"
|
|
89
89
|
},
|
|
90
90
|
"dependencies": {
|
|
91
|
-
"@genesislcap/foundation-broadcast-channel": "15.86.
|
|
92
|
-
"@genesislcap/foundation-logger": "15.86.
|
|
93
|
-
"@genesislcap/foundation-user": "15.86.
|
|
94
|
-
"@genesislcap/foundation-utils": "15.86.
|
|
95
|
-
"@genesislcap/web-core": "15.86.
|
|
91
|
+
"@genesislcap/foundation-broadcast-channel": "15.86.1-FUI-2666.3",
|
|
92
|
+
"@genesislcap/foundation-logger": "15.86.1-FUI-2666.3",
|
|
93
|
+
"@genesislcap/foundation-user": "15.86.1-FUI-2666.3",
|
|
94
|
+
"@genesislcap/foundation-utils": "15.86.1-FUI-2666.3",
|
|
95
|
+
"@genesislcap/web-core": "15.86.1-FUI-2666.3",
|
|
96
96
|
"@microsoft/fast-element": "1.14.0",
|
|
97
97
|
"@microsoft/fast-foundation": "2.50.0",
|
|
98
98
|
"bowser": "^2.11.0",
|