Follow the code below:
void OnChange(object sender, SqlNotificationEventArgs e)
{
//from here we will send notification message to client
NotificationHub.SendNotification("João"); // <----- Aqui
....
}
Hub:
public void SendNotification(string who)
{
string name = HttpContext.Current.User.Identity.Name;
foreach (var connectionId in _connections.GetConnections(who))
{
Clients.Client(connectionId).addNotification(name + ": " + "message");
}
}
Line error NotificationHub.SendNotification(Who);
:
An object reference is required for the field, method, or property "NotificationHub.SendNotification (string)" not static
Any solution?