How to use the @microsoft/signalr.HubConnectionState.Connected function in @microsoft/signalr

To help you get started, we’ve selected a few @microsoft/signalr examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github FabianGosebrink / ASPNETCore-Angular-SignalR-Typescript / frontend / angularsignalrclient / src / app / core / services / signalR.service.ts View on Github external
private startConnection() {
    if (this.hubConnection.state === HubConnectionState.Connected) {
      return;
    }

    this.hubConnection.start().then(
      () => {
        console.log('Hub connection started!');
        this.connectionEstablished$.next(true);
      },
      error => console.error(error)
    );
  }