0

Here is my stuff:

Javascript:

 var connection = new signalR.HubConnectionBuilder()
                .configureLogging(signalR.LogLevel.Debug)
                .withUrl("/client/?hub=myHub")
                .withAutomaticReconnect().build();

OR

 var connection = new signalR.HubConnectionBuilder()
                .configureLogging(signalR.LogLevel.Debug)
                .withUrl("https://azure-service.service.signalr.net/client/?hub=myHub")
                .withAutomaticReconnect().build();

C# Startup.cs:

    // Azure SignalR service
    app.UseAzureSignalR(routes =>
    {
        routes.MapHub<MyHub>("/myHub");
    });

Its getting following error: 400 - https://localhost:44324/client/negotiate?hub=myHub&negotiateVersion=1 Failed to complete negotiation with the server: Error

Komal
  • 11
  • 2
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – Community Sep 24 '21 at 00:44

1 Answers1

0

You need add ConnectionString in appsettings.json. It works for me. You also can download my sample code.

enter image description here

enter image description here

Jason Pan
  • 15,263
  • 1
  • 14
  • 29
  • I did added as well @Jason Pan – Komal Sep 20 '21 at 08:12
  • @Komal Using my sample code, can the program run normally? – Jason Pan Sep 20 '21 at 08:14
  • Yes @Jason Pan i did tried by adding my connection string in your project and its worked for me. Your stuff is helped for fixing my issue. Thank you so much :) – Komal Sep 20 '21 at 12:44
  • can u please review this if you have idea, can u please help for this too much appreciated. https://stackoverflow.com/questions/69254747/how-to-call-signalr-clientjavascript-from-background-services-like-from-api-on – Komal Sep 20 '21 at 12:52