-
Notifications
You must be signed in to change notification settings - Fork 164
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
Reconnect issue when connection lost #297
Comments
I made a PR to address the reconnection issue. Let me know if it works. |
Thanks for your effort, I will check it tonight. |
I was tried to test it but I got an error message when I just tried to connect to the server:
I also updated the server to work with the same version of dotNetify which is in the PR, but it's not working properly anymore. I was on version 4.1.1 right before I moved to this version. Is it possible that I need to do something to be able to work with this workaround what the PR contains? Side note: I have a React admin page for the same application and it's working with the current version but Xamarin cannot connect anymore. |
I'm not seeing the error with the DotNetClient demo. Can you try to reproduce it there? Make sure both client and server are on the same .NET version. You can also try setting the serialization method to Newtonsoft. |
Actually, I could only use .NET Standard 2.0 or 2.1 in Xamarin. I tried both but I saw the DotNetifyLib.Core project uses 2.0. So, I just created a small application which just could connect to the server and get a list of objects. The same thing happened. I couldn't test the demo client, because I'm on macOS and not able to build those projects because it's incompatible with my OS. The problem happens when it's trying to call the ConnectAsync method which never returns. It calls in DotNetifyHubProxy.cs:162 the Request_VM method which calls HubConnection.SendCoreAsync with the desired parameters but it's never returned. While the application runs the ConnectAsync looks like never happens and not returning as well. Is this maybe a SignalR issue? I can send you a sample project if you need it, as I already created it, just let me know. Thanks for your help! |
I can take a look if you put a sample project in a public repo. BTW, your client, is it still on version 4? If so, you'll need to upgrade it too. Here's the info on how to switch to Newtonsoft. |
I will check the communication with Newtonsoft as well. |
I just created a sample application to be able to test it on your side. |
For some reason, I wasn't able to get your sample application to show up on my android emulator (pixel 3). But I could create a Xamarin client demo from scratch (source code added to PR). The connection retry logic in the PR is working, but there is a long delay of 2 minutes after a server restart until the Xamarin client re-establish the connection. This does not happen with the desktop client. I reduced all the timeout settings exposed by the SignalR connection API to no effect. So perhaps it's another setting that the SignalR API doesn't expose, or it has something to do with the Android itself. At this point, I feel it's no longer an issue with dotNetify, and you should take it up in the SignalR forum. |
Thank you for your effort. It's really close to that solution what I did on my side. I will check it, but I think we were faced with the same issue, because sometimes I had the feeling that I could reconnect or the SignalR could, but it happened only once when I have tested it. |
I'm closing this as the reconnection issue has been addressed with the latest release v5.2. As for the prolonged time it takes for the Xamarin client to re-establish the connection, it doesn't appear to be an issue with dotNetify. |
Hi,
I use dotNetify in a Xamarin Forms application and I find an issue when the connection has been lost.
In this case, we cannot communicate with the remote view model anymore, meaning you are not able to dispatch any command and not get any updates from the server.
I tried to create my own mechanism that just monitoring the connection and if it's terminated then I try to reconnect:
The page view model looks like this:
The backend side looks like this:
So, the main problem is, even if I trying to reconnect manually or keep everything as it is, the communication between the client and the backend totally lost, and not able to work with the data anymore. When opening a new ViewModel then also not able to get any data from the server. Maybe I just "overlook" something and you have an idea why is it happening.
What is the right way to handle the situation when the client connection to the server is totally terminated? Should it connect back automatically or do I need to add some extra argument to do so or is there a workaround for this?
Thanks for your kind help!
The text was updated successfully, but these errors were encountered: