-
Notifications
You must be signed in to change notification settings - Fork 10.4k
Disconnect / Reconnect #5282
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
Comments
@aswanevelder I don't think so, at least I couldn't find it. I'm doing it using |
There is no reconnect in this version of SignalR so there is no event. |
We're looking at adding the automatic reconnect functionality back to SignalR in the next preview release. |
Thanks guys, @davidfowl looking forward to it! |
@davidfowl sounds great! Do you have road map for the next few months? |
@davidfowl @aswanevelder @KirilRusev |
It’s all client side. All we’re going to do is make sure the connection is reusable and there’s a way to auto reconnect. The server isn’t managing anything |
Reopening, we are going to be adding automatic reconnect Closed event called once reconnect tries are done |
We are going to make the connection restartable (so it's easy to add restart logic), but not automatically restart. We can investigate adding automatic reconnection in a future release. |
Hi guys, I'm developing a local dashboard web app that fetch data from many Rpi connected to the same local network. I'm using HubConnection on client side, with a stream subscribe. It works very well except for the fact that sometimes when I navigate to another page and then return to the dashboard page, I got this error: "cannot send data if the connection is not in the 'connected' state". If I try to refresh the page I got the same error, but if I try to refresh the page using CTRL+F5 (clear cache) It works. I don't understand why, Any Ideas? Thanks :) |
After some tests, I discover that the problem was a 'timing problem'. I was checking the state of my application in order to start the streaming in the windows on load event where the signalR connection sometime was still in connecting state (code=1), that's why sometimes I got that error. I've found this sample that is very helpful to handle this kind of scenario! |
Disussion is mainly about JavaScript client I guess. |
When we implement automatic reconnect (just to clarify, manual reconnecting is possible today by simply calling |
@aswanevelder @davidfowl @kmorcinek Guys can you take a look at my implementation of automatic reconnect for .NET Client and test it to see if it works for you. https://www.radenkozec.com/net-core-signalr-automatic-reconnects/ |
@radenkozec The sample you posted looks good, but you shouldn't have to recreate the HubConnection each time. If you're seeing issues with reusing the same HubConnection instance, let us know in a new issue. |
@anurse Thanks for feedback. I have improved my code to re-use HubConnection. |
I was about to ask clarifications about how to handle reconnect on the typescript client but I found this in the meantime: dotnet/AspNetCore.Docs#6757 I must say your release process makes me a bit confused but maybe it's just me. Probably it doesn't help (me) that you have .NET and Typescript clients in the same repository. Talking about the Typescript client here, you seem to have some 2.x versions finalised but latest version on npm is 1.0.3, so I don't even know if I will be able to reconnect with 1.03. |
Since we're now doing this in 3.0. I've split this issue into separate ones for each client (since the work will be done per-client). I'm going to close this issue in lieu of those separate ones now. |
Hi guys,
Are there javascript events available yet for Disconnect and Reconnect as was available in SignalR 2?
Thanks
The text was updated successfully, but these errors were encountered: