Skip to content

Improve WebSocket connection handling #2027

@maciaszczykm

Description

@maciaszczykm

What would you like to be added? / User Story: At the moment WebSocket added in #2008 is handled through 2 subjects. One of them is a representation of connection with the API, the second one acts like a proxy that is filtered from errors. We should check if we can improve it and remove the proxy subject to simplify things.

Example (not working in 100%):

  get adminSettings(): Observable<AdminSettings> {
    const webSocket$ = webSocket<AdminSettings>(`${this.wsRoot}/admin/settings`).pipe(
      startWith(DEFAULT_ADMIN_SETTINGS),
      catchError(() => onErrorResumeNext(EMPTY)),
      map(settings => this._defaultAdminSettings(settings)),
      shareReplay({refCount: true, bufferSize: 1})
    );

    return iif(() => this._auth.authenticated(), webSocket$, of(DEFAULT_ADMIN_SETTINGS));
  }

Metadata

Metadata

Assignees

Labels

kind/featureCategorizes issue or PR as related to a new feature.priority/normalNot that urgent, but is important

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions