1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

Unable to connect signalr hub with jwt authentication

Discussão em 'Angular' iniciado por Vansh Gupta, Novembro 21, 2025.

  1. Vansh Gupta

    Vansh Gupta Guest

    List item

    [2025-11-19T14:03:33.645Z] Error: Failed to start the transport 'WebSockets': Error: WebSocket failed to connect. The connection could not be found on the server, either the endpoint may not be a SignalR endpoint, the connection ID is not present on the server, or there is a proxy blocking WebSockets. If you have multiple servers check that sticky sessions are enabled.

    this.hubConnection = new signalR.HubConnectionBuilder()
    .withUrl(
    `${environment.serviceUrl}/hubs/notifications?userId=${userId}&applicationId=${applicationId}`,
    {
    accessTokenFactory: () => {
    return this.authService.idToken;
    },

    transport: signalR.HttpTransportType.WebSockets

    }
    )
    .withAutomaticReconnect()
    .configureLogging(signalR.LogLevel.Debug)
    .build();

    this.hubConnection
    .start()
    .then(() => console.log('[SignalR] Connected'))
    .catch(err => console.error('[SignalR] Connection error:', err));
    }


    I have already allowed cores

    services.AddCors(o => o.AddPolicy("AllowCors", builder =>
    {
    builder.SetIsOriginAllowed(origin => true)
    .AllowAnyMethod()
    .AllowAnyHeader()
    .AllowCredentials();
    }));


    and same thing when i am doing with application which does not use any auth, it works.

    Continue reading...

Compartilhe esta Página