Get number of listeners, clients connected to SignalR hub

There is no way to get this count from SignalR as such. You have to use the OnConnect() and OnDisconnect() methods on the Hub to keep the count yourself. Simple example with a static class to hold the count: public static class UserHandler { public static HashSet<string> ConnectedIds = new HashSet<string>(); } public class MyHub … Read more

Calling SignalR hub clients from elsewhere in system

This is the correct way for SignalR 2.x: var context = GlobalHost.ConnectionManager.GetHubContext<MyHub>(); context.Clients.All.addMessage(message); Basically, you can use the dependency resolver for the current host to resolve the IConnectionManager interface which allows you to get ahold of the context object for a hub. Further information can be found in the official documentation.

Call SignalR Core Hub method from Controller

Solution 1 Another possibility is to inject your HubContext into your controller like: public VarDesignCommController(IHubContext<VarDesignHub> hubcontext) { HubContext = hubcontext; … } private IHubContext<VarDesignHub> HubContext { get; set; } Then you can also call await this.HubContext.Clients.All.InvokeAsync(“Completed”, id); But then you will direct call methods on all clients. Solution 2 You can also work with typed … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)