I want to call a hub method from my aspx.cs file and I don't know how. I've already searched for answers and nothing works, this seems to work for others, but it's also not working
var context = GlobalHost.ConnectionManager.GetHubContext<ChatHub>();
context.Clients.All.brod("notify called");
This the caller method:
public void Notify()
{
var context = GlobalHost.ConnectionManager.GetHubContext<ChatHub>();
context.Clients.All.brod("notify called");
}
This is the js method for displaying:
chat.client.brod = function (msg) {
messages.append('<li>'+msg+' </li>');
}
So, how to call a Hub method from C#?
Please help...