Unable to connect to SignalR hub written in ASP.NET 7, client is in Angular

103 Views Asked by At

cannot connect to hub. I am using Angular to connect to my SignalR Hub that is wrote in C# (ASP NET CORE 7)

this is the frontend code :

this.connection = new HubConnectionBuilder()
      .withUrl("https://localhost:5168/hub-chat",{
        skipNegotiation: true,
        transport: signalR.HttpTransportType.WebSockets
      })
      .build();

and this is backend code configuration

var connectionString = configuration.GetSection(nameof(RedisOptions)).GetChildren().ElementAt(0).Value;

            services.AddSignalR(options =>
            {
                options.EnableDetailedErrors = true;
                options.KeepAliveInterval = System.TimeSpan.FromMinutes(10);
            }).AddStackExchangeRedis(connectionString);

and mapping for hub

 builder.MapHub<ChatHub>("hub-chat");
0

There are 0 best solutions below