dsuryd / dotNetify

Simple, lightweight, yet powerful way to build real-time web apps.
https://dotnetify.net
Other
1.17k stars 164 forks source link

v5.2 no signalr hub connection with older chrome version #303

Closed DG4ever closed 2 years ago

DG4ever commented 2 years ago

Hi,

I am using dotnetify in a project with some Smart TVs where I can't update chrome. They are based on chrome version 63. Everything is working fine with version 5.1. But in 5.2 you changed from @aspnet/signalr to @microsoft/signalr. And in this version I can't get a connection to my viewmodels with chrome 63. Newer chrome versions will work just fine. Unfortunately there are no errors while debugging.

But dotnetify.hub.isConnected will return null.

Do you have an idea what might cause this problem?

dsuryd commented 2 years ago

The @microsoft/signalr migration required me to modify the implementation of isConnected to this:

https://github.com/dsuryd/dotNetify/blob/b7326681d28031127eeed45118fe8e960089784d/DevApp/src/dotnetify/core/dotnetify-hub.ts#L93

Originally it was this: https://github.com/dsuryd/dotNetify/blob/3c742c4ed6b3f654f1153b91e4ccb8472843db87/DevApp/src/dotnetify/core/dotnetify-hub.ts#L102-L103

So try updating that line to check for both.

DG4ever commented 2 years ago

I did some more research and the new SignalR version uses AbortController which is not available in older browsers. In my case I used https://www.npmjs.com/package/abortcontroller-polyfill as a workaround. Now older browsers are working again.

dsuryd commented 2 years ago

Glad you found a workaround! No change seems to be required in dotNetify, so I'm closing this issue.