Today my web application (ASP.NET MVC4) is running only once (1 instance).
If an action needs to push something to all clients, I do it in this way:
public ActionResult SomeAction(...)
{
// Stuff happenning here...
// ...
// Push notify
var hubContext = GlobalHost.ConnectionManager.GetHubContext<MyHub>();
hubContext.Clients.Group("SomeGroup").pushSomething();
}
Now my web application needs to run in multiple instances, with a load balancer that redirects the users to different instances of the same application.
A client could be using http://someIPAddress
or http://otherIPAddress
and it should feel and be the same for the client.
The question is, how do I use SignalR in this case? with multiple hubs
I suppose it is something like the following:
public ActionResult SomeAction(...)
{
// Stuff happenning here...
// ...
// Push notify
foreach (var hub ....) // <-- This!
hubContext.Clients.Group("SomeGroup").pushSomething();
}
But I'm not sure.
Other information: this app is running in Windows Azure, and the "instances" will be defined by the "Azure web site number of instances"