Skip to content

Update lastMessageAt in markLastMessage#4544

Merged
halter73 merged 4 commits intomainfrom
halter73/4536
Mar 31, 2021
Merged

Update lastMessageAt in markLastMessage#4544
halter73 merged 4 commits intomainfrom
halter73/4536

Conversation

@halter73
Copy link
Member

I'm hoping this fixes #4536.

markLastMessage should still run frequently enough to keep lastMessageAt up-to-date despite chrome's new timer throttling because markLastMessage called by "network response handlers". This means we have to effectively disable our lastMessageAt checking logic if keep-alives are disabled.

Copy link
Member

@BrennanConroy BrennanConroy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, but lets wait for some customer feedback, or until we can test it ourselves.

If there is no keep alive configured, we cannot assume that timer callbacks
will run frequently enough to keep lastActiveAt updated.

#4536
@halter73
Copy link
Member Author

I'm going to merge this so people can try out Microsoft.AspNet.SignalR.JS version 2.4.2-preview2-* from the https://pkgs.dev.azure.com/dnceng/public/_packaging/myget-legacy/nuget/v3/index.json NuGet feed once it makes it through our CI pipeline.

I ran the build locally and it passed. If there are any issues I'll submit a follow up PR.

@halter73 halter73 merged commit f0b5684 into main Mar 31, 2021
@halter73 halter73 deleted the halter73/4536 branch March 31, 2021 19:21
@jahmai-ca
Copy link

Great work and really hope this fixes Chrome reconnecting SignalR over and over. Is there a preview for AspNetCore 3.1?

@BrennanConroy
Copy link
Member

ASP.NET Core 3.1 has been out for over a year. Also, this repo is for ASP.NET SignalR which is unrelated to ASP.NET Core.

If you're looking to try out the recent changes to the ASP.NET SignalR JavaScript client, you can use

@jahmai-ca
Copy link

jahmai-ca commented Apr 2, 2021

Hi Brennan,

Sorry I confused this repo for aspnet/SignalR (EDIT: dotnet/aspnetcore), as #4536 describes an identical issue that we're seeing in the AspNetCore version of SignalR.

Didn't mean to offend.

Cheers.

@halter73
Copy link
Member Author

halter73 commented Apr 5, 2021

@nitzzzu I see you've deleted the following comment

I've tested 2.4.2-preview2 in my notification service and it does not seem to solve the issue. The client still gets disconnected when idle.

Does this mean 2.4.2-preview2 is working for you?

@nitzzzu
Copy link

nitzzzu commented Apr 5, 2021

@halter73 yes. I've just used the jquery. signalr.js on client side while keeping an older version on the server side and it seems to work fine

// run frequently enough to keep lastActiveAt updated.
// https://github.com/SignalR/SignalR/issues/4536
if (!connection._.keepAliveData.activated ||
new Date().getTime() - connection._.lastActiveAt < connection.reconnectWindow) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about using a "forward only" time like performance.now() which does not depend on the system clock which might change with timezones / NTP / manually?

@MukeshJ2506
Copy link

Hi from where can i install 2.4.2 version with this fix? i cant see the npm library updated. Apology for my lack of insight here

@wbeeftink
Copy link

Hi from where can i install 2.4.2 version with this fix? i cant see the npm library updated. Apology for my lack of insight here

Hi @MukeshJ2506, what worked for me was this:

  1. Download NuGetPackageExplorer
  2. Copy the feed URL from this comment
  3. Open the feed in package explorer
  4. Search for SignalR and download the 2.4.2. preview version from there
  5. This will give you a NuGet package that contains the .js files you can extract

I don't usually work with NuGet packages, so perhaps there are much easier ways ;-)

@MukeshJ2506
Copy link

Hi from where can i install 2.4.2 version with this fix? i cant see the npm library updated. Apology for my lack of insight here

Hi @MukeshJ2506, what worked for me was this:

1. Download [NuGetPackageExplorer](https://github.com/NuGetPackageExplorer/NuGetPackageExplorer)

2. Copy the feed URL from [this comment](https://github.com/SignalR/SignalR/pull/4544#issuecomment-812028464)

3. Open the feed in package explorer

4. Search for SignalR and download the 2.4.2. preview version from there

5. This will give you a NuGet package that contains the .js files you can extract

I don't usually work with NuGet packages, so perhaps there are much easier ways ;-)

@wbeeftink Appreciate your response. thank you 😃

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Chrome terminates WebSocket conenction

7 participants