Osa E
Osa E

Reputation: 1781

How do you send from code behind - signalR 1.0.1?

I have a situation where I am using signalR and asp.net. My implementation is very similar to chat example at asp.net

My question is how do I send from code behind? All examples use an older version of SignalR.

Upvotes: 0

Views: 1423

Answers (1)

Eonasdan
Eonasdan

Reputation: 7765

Inside your hub create a void like so:

public static void UpdateClients()
{
    var context = GlobalHost.ConnectionManager.GetHubContext<NameOfHub>();
    context.Clients.All.ClientSideFunction();
}

then use as:

NameOfHub.UpdateClients();

Upvotes: 1

Related Questions