Blazor Server save SignalR connection to database to prevent loss?

Viewed 292

SignalR connection is connection between server and user and its "stored" in server memory.

There are some scenarios where SignalR is lost and user needs to reload the page.

  1. When I need to restart the Server
  2. When users sleeps his phone and get back to website after some time

Is it somehow possible to save these SignalR connection instances to Database, so when i restart my server it will reload them into Memory and user is able to reconnect to his previous state ?

2 Answers

I persist the connected users. In scaled services there is no guarentee you will get the same instance of the server. There is a feature called auto reconnect you can look at on the hub context other than that you should configure your clients to reconnect by monitoring the connection state. Either way you will get a new connectionId.

Related