Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AzureSignalR connection correct, but not notifying #126

Open
DavidStania opened this issue Mar 2, 2020 · 6 comments
Open

AzureSignalR connection correct, but not notifying #126

DavidStania opened this issue Mar 2, 2020 · 6 comments

Comments

@DavidStania
Copy link

DavidStania commented Mar 2, 2020

Hey Guys,

I have a smal problem after publishing my web app on azure and consuming AzureSignalR.
After starting app, connection is working well and I can join groups. But if I push a Notification from my app like

 await hubContext.Clients.Groups(arbeitssystem.ShortId).SendAsync("StateChanged", arbeitssystem.ShortId);

groups were not notifyed.

#setup.cs ConfigureServices

            services.AddSignalR().AddHubOptions<Hubs.TwinHub>(options =>
            {
                options.EnableDetailedErrors = true;
            }).AddAzureSignalR();
app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllers();
                endpoints.MapRazorPages();
                endpoints.MapHub<Hubs.TwinHub>("/TwinHubDashboard");
                endpoints.MapControllerRoute("api", "api/{controller}/{action}");
            });

But without .AddAzureSignalR(), so as local service, everything is working. Also after publishing on azure.
Any ideas whats going wrong?

@vwxyzh
Copy link
Contributor

vwxyzh commented Mar 3, 2020

@DavidStania It should be OK, can you repro the issue after restarting the service instance?
And can you send your resource id to my email address: [email protected]?

@DavidStania
Copy link
Author

@vwxyzh after restarting service, problem still exists.
ResourceId I sended to you. Thank you.

@vwxyzh
Copy link
Contributor

vwxyzh commented Mar 3, 2020

Let me check the service log.

@DavidStania
Copy link
Author

DavidStania commented Mar 3, 2020

I don't know why, but i got this erro

Microsoft.Azure.SignalR.ServiceConnection[2]
      Failed to connect to '(Primary)https://xxxx.service.signalr.net', will retry after the back off period. Error detail: The server returned status code '400' when status code '101' was expected.. The server returned status code '400' when status code '101' was expected.. Id: 38eb1154-da23-4313-8156-8e913d212cb1

Today it is not possible to established connection.

Yesterday, same doing:
image

@DavidStania
Copy link
Author

found my mistake!

Right

 var connection = new signalR.HubConnectionBuilder()
        .withUrl('/TwinHubDashboard')
        .configureLogging(signalR.LogLevel.Information)
        .build();

Wrong

    var connection = new signalR.HubConnectionBuilder()
        .withUrl('/TwinHubDashboard', {
            skipNegotiation: true,
            transport: signalR.HttpTransportType.WebSockets
        })
        .configureLogging(signalR.LogLevel.Information)
        .build();

while skipping Negotation, connection never starts with azure service.
After removing this part, everything is working like expected.

@vwxyzh Thank you for support.

@dazinator
Copy link

i am seeing the same error, but I am not skipping negotiation.
The client tries to send a negotiate request and get's an error 500 response

Request URL: https://foo-dev-pr167.azurewebsites.net/hubs/webnotifications/negotiate?negotiateVersion=1
Request Method: POST
Status Code: 500
Remote Address: 137.117.203.130:443
Referrer Policy: no-referrer-when-downgrade

Looking at the logs on the server:

I am seeing this repeated:

Client negotiate failed: Azure SignalR Service is not connected yet, please try again later.
29 Jun 2020 18:13:27.805
Failed to connect to '(Primary)https://foo-dev.service.signalr.net', will retry after the back off period. Error detail: The server returned status code '400' when status code '101' was expected.. The server returned status code '400' when status code '101' was expected.. Id: 13f27c22-9f02-47c0-8c78-d83c157b4ce7
29 Jun 2020 18:13:27.804
Transport is stopping.
29 Jun 2020 18:13:27.716
Starting transport. Transfer mode: Binary. Url: 'wss://foo-dev.service.signalr.net/server/?hub=43e1b6f6e3f14c31b4ddbccf011c9b0d_webnotificationhub&cid=13f27c22-9f02-47c0-8c78-d83c157b4ce7'.

I logged this issue: Azure/azure-signalr#944 already but perhaps this is related?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants