SignalR based backplane

SignalR is being used in more and more projects. But, scaling SignalR application has an inherent limitation, where the web application needs to be able to talk to a backplane directly. In some cases this kind of deployment maybe unacceptable. When we were trying to leverage SignalR for realtime notifications, we encountered this exact limitation, where we did not want our web application to directly talk to a datastore, be it SQL Server or REDIS. Also having this knowledge in the web application means that the deployment of the web application would be different based on the backplane. This also means, that if our backend services needed to use that backplane it would also need to know the kind of backplane and how to deploy.
Hence, we decided to abstract the specific backplane information from the web application and any other components who would need to access the backplane. We ended up creating a backplane provider which is based on SignalR.
The artifacts are available from NuGet. It consists of three components:
  1. SDL.SignalR.SignalRMessageBus: This is the component which is living on the web application part of the application. Configuring it is very simple. Just add the NuGet package and in your OWIN startup just use 


  2. Sdl.SignalR.Backplane.Hub: This is the component that lives along with the other backend services of your application. Just add the NuGet package and in your OWIN startup use the custom HubLoader available with the package. The syntax is public static void
     Load(IAppBuilder app, string assembly, string scaleoutConfigurationType, &nbsp;string scaleoutMessageBusType, string hubAssemblyName, bool patchOnReceived, params object[] backplaneConfigurationParameters)  


    • app: An instance of an IAppBuilder used in IIS hosted application.
    • assembly: Full assembly name that contains message bus and scaleout configuration implementation.
    • scaleoutConfigurationType: Type name of scaleout configuration used to configure message bus. This type must be inherited from ScaleoutConfiguration
    • scaleoutMessageBusType: Type name of a message bus. This type must implement IMessageBus interface.
    • hubAssemblyName: Full assembly name that contains hub interface.
    • patchOnReceived: Specify true.
    • backplaneConfigurationParameters: Parameters we need to create a backplane instance (e.g. backplane connectionString)
 string sqlConnectionString = "Data Source=(local);Initial Catalog=signalr;User ID=signalrsa;Password=Pass123";  
Type messageBusType = typeof(SqlMessageBus);
Type messageBusConfigurationType = typeof(SqlScaleoutConfiguration);
Type hubType = typeof(SdlBackplaneHub);
HubLoader.Load(app, messageBusType.Assembly.FullName, messageBusConfigurationType.FullName, messageBusType.FullName, hubType.Assembly.FullName, true, sqlConnectionString);

Both of the NuGet components use a common package Sdl.SignalR.Backplane.Common. This is also available in GitHub. The GitHub contains a sample as well which is using Sql Server as the final backplane.

Leave a Reply

Your email address will not be published. Required fields are marked *