First of all, excuse my English, it's very bad. I am using ASP.NET Core SignalR 2.2 with JwtBearerToken authentication. For business requirements I need to avoid that a user can open more than one connection simultaneously, that is, a user can only have
an active connection in the Hub at the same time. In case that same user tries to connect again, the server must deny the connection. How could I implement this?
For business requirements I need to avoid that a user can open more than one connection simultaneously, that is, a user can only have an active connection in the Hub at the same time. In case that same user tries to connect again, the server must deny the connection.
How could I implement this?
It seems that you want a user can only establish an active connection to your hub server
simultaneously even if the user connect from different clients/platforms, to implement it, you can maintain user login status info on your hub server (or in a store, such as database etc), and check the current user login status ever time when user connect
to server, if the user account status is already active, you can prevent/deny other connection(s) in code logic.
With Regards,
Fei Han
.NET forums are moving to a new home on Microsoft Q&A, we encourage you to go to Microsoft Q&A for .NET for posting new questions and get involved today.
None
0 Points
1 Post
ASP.NET Core SignalR. User with only one connection open simultaneously?
Feb 21, 2019 06:13 PM|borjitasarria|LINK
First of all, excuse my English, it's very bad. I am using ASP.NET Core SignalR 2.2 with JwtBearerToken authentication. For business requirements I need to avoid that a user can open more than one connection simultaneously, that is, a user can only have an active connection in the Hub at the same time. In case that same user tries to connect again, the server must deny the connection. How could I implement this?
Thank you very much.
Regards, Borja
All-Star
40565 Points
6233 Posts
Microsoft
Re: ASP.NET Core SignalR. User with only one connection open simultaneously?
Feb 22, 2019 05:33 AM|Fei Han - MSFT|LINK
Hi borjitasarria,
Welcome to ASP.NET forums.
It seems that you want a user can only establish an active connection to your hub server simultaneously even if the user connect from different clients/platforms, to implement it, you can maintain user login status info on your hub server (or in a store, such as database etc), and check the current user login status ever time when user connect to server, if the user account status is already active, you can prevent/deny other connection(s) in code logic.
With Regards,
Fei Han