Skip to content

SignalR Errors when some Chrome Extensions Enabled #12378

@zanate4019

Description

@zanate4019

Describe the bug

We have an application that is nearing completion and is the final user acceptance phase. We've noticed that on some of our testers systems SignalR has connection errors. On both machines, reseting Chrome to default corrected the issue, but we're concerned that when the application moves to production this will be a support issue. On one of the systems we were able to consistently track the issue to this extension https://chrome.google.com/webstore/detail/auto-refresh/ifooldnmmcmlbdennkpdnlnbgbmfalko. The other system that was having the issue never had that extension installed.

To Reproduce

Steps to reproduce the behavior:

  1. Using this version of ASP.NET Core '2.2.6'
  2. Run this code
    2a. on server
            app.UseSignalR(routes => routes.MapHub<ExamHub>(srConfig.ExamHubUrl, o =>
            {
                o.ApplicationMaxBufferSize = 0;
                o.TransportMaxBufferSize = 0;
            }));

2b. on client

  private _initiateHubConnection = (): void => {
    this._debugService.logDebug(this, ["Exam Hub Connection Initializing"], null, true, "_initiateHubConnection");
    // create connection to  signalR
    let builder = new HubConnectionBuilder();
    //if(navigator.userAgent.indexOf("Chrome") !== -1 )
    //  this.hubConnection = builder
    //    .withUrl(this._bwf.examUpdateUrl, {
    //      transport: signalR.HttpTransportType.ServerSentEvents,
    //    })
    //    .configureLogging(this._signalrLogger)
    //    // .withHubProtocol(new JsonHubProtocol())
    //    //.withHubProtocol(new MessagePackHubProtocol())
    //    .build();
    //else
      this.hubConnection = builder
        .withUrl(this._bwf.examUpdateUrl)
        // .configureLogging(this._signalrLogger)
        // .withHubProtocol(new JsonHubProtocol())
        //.withHubProtocol(new MessagePackHubProtocol())
        .build();

    // handle communication from signalR
    this.hubConnection.on("AddExams", async(notification: INotificationViewModel) => await this._onNotificationAddExams(notification));
    this.hubConnection.on("UpdateExams", async(notification: INotificationViewModel) => await this._onNotificationUpdateExams(notification));
    this.hubConnection.onclose((err) => {
      this.state = DataServiceState.disconnected;
      if (err) {
        this._debugService.logWarning(this, [err, 'Connection Restarting'], 'Error in Exams Connection',true,"_initiateHubConnection");
        toastr.warning(`Error in Exam Update Connection: ${err}`, "Error in Exam Update Connection",true,"_initiateHubConnection");
      }
      this.state = DataServiceState.connecting;
      this.hubConnection.start().then(() => this._onHubConnectionStart());
    });

    // start the connection
    this.hubConnection.start().then(() => this._onHubConnectionStart());

    this._debugService.logSuccess(this, ["Exam Hub Connection Initialized"], null, true, "_initiateHubConnection");
  };
  1. Errors in client

Expected behavior

Would like the the signalr connections to stay up reliably

Additional context

I know this is light on information. I'm really just looking for general guidelines to prevent extensions from causing issues.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs: Author FeedbackThe author of this issue needs to respond in order for us to continue investigating this issue.area-signalrIncludes: SignalR clients and servers

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions