In my hub, I have something like this (pseudocode):
public override Task OnConnected() { var isLegal = Authorize(); if (!isLegal) //not authorized { //how do I deny him this connection? } return base.OnConnected(); }
How to disconnect / prohibit connection to the user?
Add the authorize attribute above the class, the user will be denied if it is not authenticated.
The following link explains how to authenticate and authorize the hub.
http://www.asp.net/signalr/overview/security
If you decide not to use the existing auth mechanism, you will need to check whether the user is allowed in each method of the hub and return the appropriate messages.
Source: https://habr.com/ru/post/954521/More articles:The HashMap type is not generic; it cannot be parameterized with arguments - javaHow to load custom PHP Magento block inside a template file - blockfloat64 to float32 Cython error - pythonClojure Protocol implementation not found for record type in different namespace - clojureChanging default socket buffer size in Windows - windowsIs there a tool for lint to check the code for a Dart style guide? - dartAWS S3 Glacier - Initiate Recovery Programmatically - amazon-s3xcode 5, Mountain Lion: very slow performance - xcodeViewscoped JSF and CDI bean - jsfHow to iterate over properties of a prototype object - javascriptAll Articles