Giter VIP home page Giter VIP logo

Comments (11)

dsuryd avatar dsuryd commented on August 17, 2024

I made a PR to address the reconnection issue. Let me know if it works.

from dotnetify.

BajakiGabesz avatar BajakiGabesz commented on August 17, 2024

Thanks for your effort, I will check it tonight.
If you don't mind and I find any issues with it that I could recognize, then I could contribute to resolving it.

from dotnetify.

BajakiGabesz avatar BajakiGabesz commented on August 17, 2024

I was tried to test it but I got an error message when I just tried to connect to the server:

System.ArgumentNullException: Value cannot be null.
Parameter name: inputType
at System.Text.Json.JsonSerializer.Serialize (System.Text.Json.Utf8JsonWriter writer, System.Object value, System.Type inputType, System.Text.Json.JsonSerializerOptions options) [0x00009] in <3e024d1008104aac9fe12198f4c68344>:0
at Microsoft.AspNetCore.SignalR.Protocol.JsonHubProtocol.WriteArguments (System.Object[] arguments, System.Text.Json.Utf8JsonWriter writer) [0x00062] in <98d61c04d1b44672b33d354f73c63eae>:0
at Microsoft.AspNetCore.SignalR.Protocol.JsonHubProtocol.WriteInvocationMessage (Microsoft.AspNetCore.SignalR.Protocol.InvocationMessage message, System.Text.Json.Utf8JsonWriter writer) [0x0001f] in <98d61c04d1b44672b33d354f73c63eae>:0
at Microsoft.AspNetCore.SignalR.Protocol.JsonHubProtocol.WriteMessageCore (Microsoft.AspNetCore.SignalR.Protocol.HubMessage message, System.Buffers.IBufferWriter1[T] stream) [0x00080] in <98d61c04d1b44672b33d354f73c63eae>:0 at Microsoft.AspNetCore.SignalR.Protocol.JsonHubProtocol.WriteMessage (Microsoft.AspNetCore.SignalR.Protocol.HubMessage message, System.Buffers.IBufferWriter1[T] output) [0x00000] in <98d61c04d1b44672b33d354f73c63eae>:0
at Microsoft.AspNetCore.SignalR.Client.HubConnection.SendHubMessage (Microsoft.AspNetCore.SignalR.Client.HubConnection+ConnectionState connectionState, Microsoft.AspNetCore.SignalR.Protocol.HubMessage hubMessage, System.Threading.CancellationToken cancellationToken) [0x00035] in <82f2bec582b048f7a648dfe730be82f1>:0
at Microsoft.AspNetCore.SignalR.Client.HubConnection.SendCoreAsyncCore (System.String methodName, System.Object[] args, System.Threading.CancellationToken cancellationToken) [0x00169] in <82f2bec582b048f7a648dfe730be82f1>:0
at System.Threading.Tasks.ForceAsyncAwaiter.GetResult () [0x0000c] in <82f2bec582b048f7a648dfe730be82f1>:0
at Microsoft.AspNetCore.SignalR.Client.HubConnection.SendCoreAsync (System.String methodName, System.Object[] args, System.Threading.CancellationToken cancellationToken) [0x00097] in <82f2bec582b048f7a648dfe730be82f1>:0
at DotNetify.Client.DotNetifyHubProxy.Request_VM (System.String vmId, System.Collections.Generic.Dictionary`2[TKey,TValue] vmArg) [0x00052] in /Users/gabor/Documents/Sources/AppName/Dotnetify/DotNetifyLib.SignalR/Client/DotNetifyHubProxy.cs:162
at DotNetify.Client.DotNetifyClient.ConnectAsync (System.String vmId, DotNetify.Client.IViewState viewState, DotNetify.Client.VMConnectOptions options) [0x00227] in /Users/gabor/Documents/Sources/AppName/Dotnetify/DotNetifyLib.Core/Client/DotNetifyClient.cs:153
at DotNetify.Client.DotNetifyClient.ConnectAsync (System.String vmId, System.ComponentModel.INotifyPropertyChanged view, DotNetify.Client.VMConnectOptions options) [0x00042] in /Users/gabor/Documents/Sources/AppName/Dotnetify/DotNetifyLib.Core/Client/DotNetifyClient.cs:121
at AppName.Models.General.RemoteViewModelBase.ConnectAsync () [0x0012a] in /Users/gabor/Documents/Sources/AppName/AppName/AppName/Models/General/RemoteViewModelBase.cs:91

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.

from dotnetify.

dsuryd avatar dsuryd commented on August 17, 2024

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.

from dotnetify.

BajakiGabesz avatar BajakiGabesz commented on August 17, 2024

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.
I just tried to use Wireshark to dig a bit deeper and I saw the standard communication happens properly, but a bit later in the initialization process, the communication contains the next message:
{"type":7,"error":"Connection closed with an error.","allowReconnect":true}\036
It looks like the sending the request message is also delayed exactly 15 seconds:
{"type":1,"target":"Request_VM","arguments":["vmName"{"type":6}\036
And also this message differs from the React variant:
{"type":1,"target":"Response_VM","arguments":[["vmName"
When monitoring the server part in DotNetifyHub we receive messages from the client when I use React DotNetifyHub.cs:125
But when Xamarin project do the same, it gets never fired.

Is this maybe a SignalR issue?
How can I change the serialization method to Newtonsoft?

I can send you a sample project if you need it, as I already created it, just let me know.

Thanks for your help!

from dotnetify.

dsuryd avatar dsuryd commented on August 17, 2024

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.

from dotnetify.

BajakiGabesz avatar BajakiGabesz commented on August 17, 2024

I will check the communication with Newtonsoft as well.
The client and the server also use the latest update from this branch.

from dotnetify.

BajakiGabesz avatar BajakiGabesz commented on August 17, 2024

I just created a sample application to be able to test it on your side.
You can find it here.

from dotnetify.

dsuryd avatar dsuryd commented on August 17, 2024

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.

from dotnetify.

BajakiGabesz avatar BajakiGabesz commented on August 17, 2024

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.
If you don't mind, I make some tests on my side, I could create the UI side of the Xamarin demo application because in this case, others couldn't use it for an upcoming solution, because they don't see how they can bind it to the UI.
Please give me some time before closing this issue to be able to test it deeper!
Thank you!

from dotnetify.

dsuryd avatar dsuryd commented on August 17, 2024

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.

from dotnetify.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.