SignalR generates a different identifier for different instances

I created a web chat application using signalR. When the user is logged in, the user can open only 3-4 tabs and each time a different connection identifier is generated. I want that when opening a new tab or refreshing the page, a new connection identifier should not be generated. I want to use an existing connection identifier. To do this, I tried to implement the LocalStorage variable to store the hub connection. But the problem is that I cannot parse the value of the localstorage variable.

Can someone give me a solution to my problem or can someone give me some other solution to the problem?

I already tried this http://kevgriffin.com/maintaining-signalr-connectionids-across-page-instances/ but it does not work for me

+4
source share
1 answer

If the user is authenticated, you can store various connection identifiers in a HashSet. The key for the HashSet will be the username.

http://www.asp.net/signalr/overview/signalr-20/hubs-api/mapping-users-to-connections

You can use this method even if you are not authenticated. In this case, you can use SessionId instead of the username.

EDITED

I found another method. In this article, Alex Ford advises limiting your connections to 3.

0
source

All Articles