locked
ASP.NET Core SignalR. User with only one connection open simultaneously? RRS feed

  • Question

  • User1617167183 posted

    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

    Thursday, February 21, 2019 6:13 PM

All replies

  • User61956409 posted

    Hi borjitasarria,

    Welcome to ASP.NET forums.

    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

    Friday, February 22, 2019 5:33 AM