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

OnConnectedAsync & OnDisconnectedAsync not being called on startconnection #277

Open
Bresic opened this issue May 24, 2024 · 3 comments
Open

Comments

@Bresic
Copy link

Bresic commented May 24, 2024

We have a .NET 6 project using Azure.SignalR (v. 1.25.2) and an Angular 16 FE.

We created two hubs (x and y).
We are sending images through SignalR, and it works fine, the images are transported through the devices correctly, but when we are establishing the connections, the OnConnectedAsync is not called (to be precise, it's being called randomly, a few times out of many).

In reality, the connection is made - in the Chrome console, I can see that the web socket is connected, and as I said we can transfer the images easily.

The issue is that we are managing a dictionary with the users connected to the hub and this dictionary is being handled in the OnConnectedAsync & OnDisconnectedAsync. Because these methods are not being invoked for some reason, our UI is showing a false negative message when a user wants to see if someone is connected to get the images.

this.hubConnection = new HubConnectionBuilder()
.withUrl(hubUrl, transportType)
.withAutomaticReconnect([2, 3, 3, 3, 3])
.build();

I could see 2 similar issues on github, but not 100% the same, as they had issue sending things through their SignalR, while we don't have that, we can send our data correctly, but the methods are just not being invoked.

The same issue persists if we use the old SignalR, not the Azure one.

@vicancy
Copy link
Contributor

vicancy commented May 27, 2024

If the issue persists without Azure, it is probably an issue related to how you use SignalR, could you share some reproable mini-project?

@Bresic
Copy link
Author

Bresic commented May 27, 2024 via email

@vicancy
Copy link
Contributor

vicancy commented May 28, 2024

Hello, I can send you more detailed information from the code but not sure if I'd be able to create a sample project for you. What part of the code you're interested in?

If you could minimize the logic to only contain the SignalR client+server part and can repro the issue consistently, it would help troubleshoot the problem greatly.

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

2 participants