When I try to connect a React client app I got 403 error
Forbidden for https://<domain of Azure SignalR>/SignalRTestHub
and 503 Service Temporarily Unavailable for
https://<IP of Azure SignalR>/SignalRTestHub.
But when the backend application connects then everything works fine. Whats going on with front-end ? Code exmple:
Asp.net core
app.UseEndpoints(endpoints =>
{
endpoints.MapHub<SignalRTestHub>("/SignalRTestHub");
endpoints.MapControllers();
});
services.AddSignalR()
.AddAzureSignalR("ConnectionString");
[Authorize]
public class SignalRTestHub : Hub
{ }
React
const newConnection = new HubConnectionBuilder()
.withUrl(`https://<DNS of Azure SignalR>/signalrtesthub`, {
skipNegotiation: true,
transport: HttpTransportType.WebSockets,
accessTokenFactory: () => "token"
})
.configureLogging(LogLevel.Error)
.withAutomaticReconnect()
.build();