Search code examples
signalrsignalr-hub

What If SignalR hub is hosted on multiple server?


I've one complex scenario.

I've one web application that will hold SignalR HUB.

This application will be hosted on multiple server.

For ex. Hub1 will be hosted on ServerA and ServerB.

Let say I have few clients on both ServerA and ServerB.

If some one broadcast some message on ServerA, then ServerB will be able to get that message (Even if I pass appropriate ConnectionID)?


Solution

  • I think in SignalR 2.0 you can take a look at Introduction to Scaleout in SignalR.

    I have not tested it, but the docs report that for example Microsoft.AspNet.SignalR.SqlServer will handle load balancing for you using SQL server.

    Ref: http://www.asp.net/signalr/overview/signalr-20/performance-and-scaling/scaleout-in-signalr

    EDIT

    Currently I'm using in production the REDIS backplane and it's simply great, simple to setup and inject in your code https://learn.microsoft.com/en-us/aspnet/signalr/overview/performance/scaleout-with-redis