dsuryd / dotNetify

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

Trouble with new hub connection #169

Closed mojo-man closed 5 years ago

mojo-man commented 5 years ago

Hi Dicky: I recently began experimenting with browsing to my app from non-localhost browsers. I modified my WebHost.CreateDefaultBuilder code (in Program.cs) to include .UseUrls("http://*:5000") and turned on debug logging. I find that when I initially connect - all is well. However - when I refresh, the console shows that I was given a new connection id - and all animation stops.

I am using the MulticastVM - so I expect that the connectionID should remain the same - correct?

dsuryd commented 5 years ago

No, browser refresh will always cause new SignalR connection ID.

mojo-man commented 5 years ago

OK - When I have only a single browser connected, a refresh causes it to hit the constructor again in my multicast vm instance - if more than one are connected, the constructor is not hit. Perhaps I need to move things out of my constructor. Is there another event that I can use to refresh my VM when a new connection is made?

mojo-man commented 5 years ago

I also didn't realize that my Dispose got called every time that I refresh the browser. That is probably the issue. I am cleaning things up in there that shouldn't be cleaned up yet (because there are other browsers connected).

dsuryd commented 5 years ago

Similar topic was discussed here: https://github.com/dsuryd/dotNetify/issues/151.

mojo-man commented 5 years ago

I saw that - thanks. I am now debugging my dispose override. I think that's where the problem lies.

mojo-man commented 5 years ago

Everything is working well now. Thanks for your help Dicky!