@genesislcap/foundation-comms 14.133.0 → 14.134.0
Sign up to get free protection for your applications and to get access to all the features.
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"socket.d.ts","sourceRoot":"","sources":["../../../src/connect/socket.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,eAAe,EAEf,UAAU,EACV,QAAQ,EAER,OAAO,EACP,YAAY,
|
1
|
+
{"version":3,"file":"socket.d.ts","sourceRoot":"","sources":["../../../src/connect/socket.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,eAAe,EAEf,UAAU,EACV,QAAQ,EAER,OAAO,EACP,YAAY,EAEb,MAAM,MAAM,CAAC;AAKd,OAAO,EAAoB,OAAO,EAA+C,MAAM,WAAW,CAAC;AACnG,OAAO,EAKL,sBAAsB,EAEvB,MAAM,qBAAqB,CAAC;AAG7B;;;;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,MAAM,MAAM,oBAAoB,GAAG;IACjC;;;;;;OAMG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB;;OAEG;IACH,eAAe,CAAC,EAAE,QAAQ,CAAC,OAAO,CAAC,CAAC;IAEpC;;OAEG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAE1B;;OAEG;IACH,sBAAsB,CAAC,EAAE,OAAO,CAAC;IAEjC;;OAEG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAE/B;;;;OAIG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAE3B;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF;;;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AC,CAAC;CAC1C;AA6bD;;;GAGG;AACH,eAAO,MAAM,MAAM,8DAAgE,CAAC"}
|
@@ -0,0 +1,10 @@
|
|
1
|
+
export declare class Ticker {
|
2
|
+
private readonly interval;
|
3
|
+
private readonly workerScript;
|
4
|
+
private worker?;
|
5
|
+
constructor(interval: number);
|
6
|
+
start(tick: (elapsedTime: number) => void): void;
|
7
|
+
stop(): void;
|
8
|
+
private runWorker;
|
9
|
+
}
|
10
|
+
//# sourceMappingURL=ticker.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"ticker.d.ts","sourceRoot":"","sources":["../../../src/connect/ticker.ts"],"names":[],"mappings":"AAAA,qBAAa,MAAM;IAUL,OAAO,CAAC,QAAQ,CAAC,QAAQ;IATrC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAK3B;IAEF,OAAO,CAAC,MAAM,CAAC,CAAS;gBAEK,QAAQ,EAAE,MAAM;IAEtC,KAAK,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,IAAI,GAAG,IAAI;IAMhD,IAAI,IAAI,IAAI;IAOnB,OAAO,CAAC,SAAS;CAQlB"}
|
@@ -3,13 +3,14 @@ import { UUID } from '@genesislcap/foundation-utils';
|
|
3
3
|
import { JSONSerializer } from '@genesislcap/foundation-utils';
|
4
4
|
import { observable } from '@microsoft/fast-element';
|
5
5
|
import { DI } from '@microsoft/fast-foundation';
|
6
|
-
import { BehaviorSubject, from, Observable, of, Subject, Subscription, throwError,
|
7
|
-
import { filter, mergeMap, switchMap, takeWhile
|
6
|
+
import { BehaviorSubject, from, Observable, of, Subject, Subscription, throwError, } from 'rxjs';
|
7
|
+
import { filter, mergeMap, switchMap, takeWhile } from 'rxjs/operators';
|
8
8
|
import { WebSocketSubject } from 'rxjs/webSocket';
|
9
9
|
import { Session } from '../session';
|
10
10
|
import { logger } from '../utils';
|
11
11
|
import { EventMessageType, MessageBuilder, MessageType } from './message';
|
12
12
|
import { exponentialScheduler, linearScheduler, MAX_RECONNECT_ATTEMPTS, retryInterval, SocketReconnectStrategy, } from './reconnectStrategy';
|
13
|
+
import { Ticker } from './ticker';
|
13
14
|
/**
|
14
15
|
* Subject that wraps a WebSocketSubject and provides a Subject interface for sending and receiving messages.
|
15
16
|
* @public
|
@@ -235,8 +236,8 @@ let SocketService = class SocketService {
|
|
235
236
|
}
|
236
237
|
prepareHeartbeat() {
|
237
238
|
var _a, _b, _c, _d;
|
238
|
-
if (this.
|
239
|
-
this.
|
239
|
+
if (this.heartbeatTicker) {
|
240
|
+
this.heartbeatTicker.stop();
|
240
241
|
}
|
241
242
|
const sendHeartbeat = () => __awaiter(this, void 0, void 0, function* () {
|
242
243
|
if (!this.isConnected)
|
@@ -251,10 +252,15 @@ let SocketService = class SocketService {
|
|
251
252
|
});
|
252
253
|
if ((_b = (_a = this.connectOptions) === null || _a === void 0 ? void 0 : _a.enableHeartbeat) !== null && _b !== void 0 ? _b : this.heartbeatIsEnabled) {
|
253
254
|
const intervalInMillisecocnds = (_d = (_c = this.connectOptions) === null || _c === void 0 ? void 0 : _c.heartbeatInterval) !== null && _d !== void 0 ? _d : this.heartbeatInterval;
|
254
|
-
this.
|
255
|
-
|
256
|
-
|
257
|
-
|
255
|
+
this.heartbeatTicker = new Ticker(intervalInMillisecocnds);
|
256
|
+
this.heartbeatTicker.start(() => {
|
257
|
+
if (this.websocket && this.isConnected) {
|
258
|
+
sendHeartbeat();
|
259
|
+
if (this.heartbeatLoggingIsEnabled) {
|
260
|
+
logger.debug(`Sending a heartbeat ping every ${intervalInMillisecocnds} ms`);
|
261
|
+
}
|
262
|
+
}
|
263
|
+
});
|
258
264
|
}
|
259
265
|
}
|
260
266
|
reconnect() {
|
@@ -0,0 +1,27 @@
|
|
1
|
+
export class Ticker {
|
2
|
+
constructor(interval) {
|
3
|
+
this.interval = interval;
|
4
|
+
this.workerScript = `
|
5
|
+
const startTime = Date.now();
|
6
|
+
setInterval(function() {
|
7
|
+
self.postMessage(Date.now() - startTime);
|
8
|
+
}, ${this.interval});
|
9
|
+
`;
|
10
|
+
}
|
11
|
+
start(tick) {
|
12
|
+
this.stop();
|
13
|
+
this.runWorker(tick);
|
14
|
+
}
|
15
|
+
stop() {
|
16
|
+
if (this.worker) {
|
17
|
+
this.worker.terminate();
|
18
|
+
delete this.worker;
|
19
|
+
}
|
20
|
+
}
|
21
|
+
runWorker(tick) {
|
22
|
+
if (!this.worker) {
|
23
|
+
this.worker = new Worker(URL.createObjectURL(new Blob([this.workerScript], { type: 'text/javascript' })));
|
24
|
+
this.worker.onmessage = (message) => tick(message.data);
|
25
|
+
}
|
26
|
+
}
|
27
|
+
}
|
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": "14.
|
4
|
+
"version": "14.134.0",
|
5
5
|
"sideEffects": false,
|
6
6
|
"license": "SEE LICENSE IN license.txt",
|
7
7
|
"main": "dist/esm/index.js",
|
@@ -59,8 +59,8 @@
|
|
59
59
|
"test:debug": "genx test --debug"
|
60
60
|
},
|
61
61
|
"devDependencies": {
|
62
|
-
"@genesislcap/foundation-testing": "14.
|
63
|
-
"@genesislcap/genx": "14.
|
62
|
+
"@genesislcap/foundation-testing": "14.134.0",
|
63
|
+
"@genesislcap/genx": "14.134.0",
|
64
64
|
"@types/js-cookie": "^3.0.2",
|
65
65
|
"@types/json-schema": "^7.0.11",
|
66
66
|
"@types/webappsec-credential-management": "^0.6.2",
|
@@ -68,8 +68,8 @@
|
|
68
68
|
},
|
69
69
|
"dependencies": {
|
70
70
|
"@finos/fdc3": "^1.2.0",
|
71
|
-
"@genesislcap/foundation-logger": "14.
|
72
|
-
"@genesislcap/foundation-utils": "14.
|
71
|
+
"@genesislcap/foundation-logger": "14.134.0",
|
72
|
+
"@genesislcap/foundation-utils": "14.134.0",
|
73
73
|
"@microsoft/fast-element": "^1.12.0",
|
74
74
|
"@microsoft/fast-foundation": "^2.49.4",
|
75
75
|
"analytics": "^0.8.0",
|
@@ -86,5 +86,5 @@
|
|
86
86
|
"publishConfig": {
|
87
87
|
"access": "public"
|
88
88
|
},
|
89
|
-
"gitHead": "
|
89
|
+
"gitHead": "2e07ccefac615ca60229b55ffed0da7ed23dfeca"
|
90
90
|
}
|