Search code examples
databasesignalrsignalr-backplane

SignalR backplane and databaseinput?


We have a load balanced webserver setup and we therefore want to use SignalR for client/server communication with a SignalR backplane.

How can we make sure that only one server writes to the database when a client sends something to the server? The backplane will re-route the message to all servers, but not all servers can write the same thing to the DB!

Any techniques/suggestions for how I can both use the SignalR backplane and only write to DB from one server?

In my ideal world I would receive the message on one server, store message to DB and then put a message (maybe not the same as the incoming message) on to the backplane.


Solution

  • The SignalR backplane only forwards messages sent from the server to client to all servers. This is done so SignalR can ensure messages will get to their intended client(s) even if they are connected to another server.

    When a SignalR client invokes a Hub method, the Hub method is only invoked on one server even if there are multiple SignalR servers behind a load balancer communicating via a backplane.