2
votes

I have an asp.net core 3.1 project with signalr. Some of my users seem to disconnect/reconnect their websockets signalr connection every 2 minutes: logs of 2 minute reconnections

This is ever better visualized by this chart:

2 minute reconnections chart

I'm aware that by default there's a 2 minute keepalive timeout on websockets controlled by asp.net - but as far as I know signalr also has it's own ping/keepalive messages specifically to avoid the websocket timeout - if I open mine I can see those clearly:

websockets keepalive messages

So the question is: why do some people's connections get broken off at 2 minutes?

Edit 1: removed my mac/linux theory as I've found some windows clients in the logs

Edit 2: I managed to score a console log from one of the affected clients:

console log from client

1
Maybe... these are disconnecting after 5 minutes, and not 2 :( Also the linked repo is for the old asp.net signalr, not the asp.net core one.Tamás Deme
Sure, but the real thing is that chrome introduced this now and it's causing all sorts of problems to everybody. Did you maybe test in another browser to see if this also happens? If not, then you rule it out. Test, say in Firefoxjpgrassi
Based on the user-agents it happens both in chrome and safariTamás Deme

1 Answers

0
votes

This is due to the KeepAlive settings which default to 2 min in your ASP.NET core server.

Documentation here !

Either add a ping-pong mechanism to keep the websocket connection open or raise this settings.