http-request-manager 18.5.18 → 18.5.19
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.
|
@@ -2869,6 +2869,8 @@ class HTTPManagerStateService extends ComponentStore {
|
|
|
2869
2869
|
this.userAction$ = this.userAction.asObservable();
|
|
2870
2870
|
this.wsConnection = false;
|
|
2871
2871
|
this.wsOptions = WSOptions.adapt();
|
|
2872
|
+
// Expose raw WS connection status directly to UI
|
|
2873
|
+
this.connectionStatus$ = this.httpManagerService.connectionStatus$;
|
|
2872
2874
|
// WebSocket
|
|
2873
2875
|
this.initWS = this.effect((wsOptions$) => wsOptions$.pipe(
|
|
2874
2876
|
// tap((wsOptions) => { debugger
|
|
@@ -3227,7 +3229,8 @@ class HTTPManagerStateService extends ComponentStore {
|
|
|
3227
3229
|
this.databaseOptions = database;
|
|
3228
3230
|
this.maxRetries = this.apiOptions.ws?.retry?.times || 3;
|
|
3229
3231
|
this.retryDelay = (this.apiOptions.ws?.retry?.delay && this.apiOptions.ws.retry.delay * 1000) || 5 * 1000;
|
|
3230
|
-
|
|
3232
|
+
// Start next retry countdown at 0 to avoid showing 5000 pre-connection
|
|
3233
|
+
this.wsNextRetry = new BehaviorSubject(0);
|
|
3231
3234
|
this.wsNextRetry$ = this.wsNextRetry.asObservable();
|
|
3232
3235
|
this.setApiRequestOptions(apiOptions, dataType, database);
|
|
3233
3236
|
if (this.databaseOptions && this.databaseOptions.table) {
|
|
@@ -3262,8 +3265,8 @@ class HTTPManagerStateService extends ComponentStore {
|
|
|
3262
3265
|
console.error('WSOptions invalid: wsServer is missing or empty');
|
|
3263
3266
|
return;
|
|
3264
3267
|
}
|
|
3265
|
-
// Setup connection status monitoring
|
|
3266
|
-
this.
|
|
3268
|
+
// Setup connection status monitoring (internal subscription to drive retry counters)
|
|
3269
|
+
this.setupConnectionStatus().subscribe();
|
|
3267
3270
|
// Make initial connection attempt
|
|
3268
3271
|
console.log('🔄 Initial WebSocket connection attempt...');
|
|
3269
3272
|
this.httpManagerService.connect(this.apiOptions.ws, this.apiOptions.ws.jwtToken || '');
|
|
@@ -3293,6 +3296,9 @@ class HTTPManagerStateService extends ComponentStore {
|
|
|
3293
3296
|
if (!this.shouldRetry)
|
|
3294
3297
|
return of(false);
|
|
3295
3298
|
const countdownEnder$ = new Subject();
|
|
3299
|
+
// Immediately reflect upcoming retry delay in seconds on UI
|
|
3300
|
+
const seconds = this.retryDelay / 1000;
|
|
3301
|
+
this.wsNextRetry.next(seconds);
|
|
3296
3302
|
return timer(0, this.retryDelay)
|
|
3297
3303
|
.pipe(take(this.maxRetries), tap(i => {
|
|
3298
3304
|
const attempt = i + 1;
|
|
@@ -4375,7 +4381,8 @@ class RequestManagerWsDemoComponent {
|
|
|
4375
4381
|
// })
|
|
4376
4382
|
// );
|
|
4377
4383
|
ngOnInit() {
|
|
4378
|
-
//
|
|
4384
|
+
// Initialize WS connection and retry driver
|
|
4385
|
+
this.stateRequestServiceDemo.updateConnection(this.server, this.wsServer, this.jwtToken, this.user);
|
|
4379
4386
|
}
|
|
4380
4387
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: RequestManagerWsDemoComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
4381
4388
|
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.14", type: RequestManagerWsDemoComponent, selector: "app-request-manager-ws-demo", inputs: { server: "server", wsServer: "wsServer", jwtToken: "jwtToken", user: "user", path: "path", wsChannel: "wsChannel" }, ngImport: i0, template: "<div style=\"margin: 2rem;\">\n\n <h2 style=\"display: flex;\">\n <span style=\"flex:1\">HTTP Request State Manager - Websockets</span>\n @if ((connectionStatus$ | async); as connected) {\n <span>\n WS -\n <span style=\"color: green;\">Connected</span>\n </span>\n } @else {\n <span style=\"color: red;\">Disconnected {{ attempts$ | async }} - {{ nextRetry$ |async }}</span>\n }\n </h2>\n\n <div>\n\n @if ((user$ | async); as userInfo) {\n <div>\n <mat-toolbar>\n <div style=\"display: flex; flex:1\">\n <div style=\"flex:1\">{{ userInfo.content.name }}</div>\n <div>({{ userInfo.content.ldap }})</div>\n </div>\n </mat-toolbar>\n </div>\n }\n\n @if ((isPending$ | async)) {\n <div>\n <mat-progress-bar mode=\"indeterminate\"></mat-progress-bar>\n </div>\n }\n\n <mat-tab-group animationDuration=\"0ms\" [selectedIndex]=\"1\">\n\n <mat-tab label=\"WS - Data Control\">\n <!-- DATA CONTROL -->\n <app-ws-data-control\n [server]=\"server\"\n [wsServer]=\"wsServer\"\n [jwtToken]=\"jwtToken\"\n [user]=\"user\"\n [path]=\"path\"\n [wsChannel]=\"wsChannel\"\n ></app-ws-data-control>\n\n </mat-tab>\n\n <mat-tab label=\"WS - Messaging\">\n <!-- MESSAGING -->\n <!-- <app-ws-messaging\n [server]=\"server\"\n [wsServer]=\"wsServer\"\n [jwtToken]=\"jwtToken\"\n [user]=\"user\"\n ></app-ws-messaging> -->\n\n </mat-tab>\n\n <mat-tab label=\"WS - Notifications\" [disabled]=\"true\">\n <!-- WS - Custom Messaging -->\n <app-ws-notifications></app-ws-notifications>\n </mat-tab>\n\n <mat-tab label=\"WS - AI Messaging\" [disabled]=\"true\">\n <!-- WS - AI Messaging -->\n <app-ws-ai-messaging></app-ws-ai-messaging>\n </mat-tab>\n\n </mat-tab-group>\n</div>\n\n</div>\n\n", styles: [""], dependencies: [{ kind: "component", type: i1$3.MatTab, selector: "mat-tab", inputs: ["disabled", "label", "aria-label", "aria-labelledby", "labelClass", "bodyClass"], exportAs: ["matTab"] }, { kind: "component", type: i1$3.MatTabGroup, selector: "mat-tab-group", inputs: ["color", "fitInkBarToContent", "mat-stretch-tabs", "dynamicHeight", "selectedIndex", "headerPosition", "animationDuration", "contentTabIndex", "disablePagination", "disableRipple", "preserveContent", "backgroundColor", "aria-label", "aria-labelledby"], outputs: ["selectedIndexChange", "focusChange", "animationDone", "selectedTabChange"], exportAs: ["matTabGroup"] }, { kind: "component", type: i9.MatProgressBar, selector: "mat-progress-bar", inputs: ["color", "value", "bufferValue", "mode"], outputs: ["animationEnd"], exportAs: ["matProgressBar"] }, { kind: "component", type: i3$2.MatToolbar, selector: "mat-toolbar", inputs: ["color"], exportAs: ["matToolbar"] }, { kind: "component", type: WsDataControlComponent, selector: "app-ws-data-control", inputs: ["server", "wsServer", "jwtToken", "user", "path", "wsChannel"] }, { kind: "component", type: WsNotificationsComponent, selector: "app-ws-notifications" }, { kind: "component", type: WsAiMessagingComponent, selector: "app-ws-ai-messaging" }, { kind: "pipe", type: i1$1.AsyncPipe, name: "async" }] }); }
|