简体   繁体   中英

SignalR scaleout client to server broadcast

Using SignalR scaleout how can I broadcast the message from client to all the servers attached to my backplane? I thought it should work by default, however only one server's hub is receiving the message.

Setup: I have 4 virtual machines behind the load balancer and I am using SignalR with Redis backplane. I have the following Hub:

public class ProgressHub : Hub
{
    public void StartProcessing(string clientId)
    {
        // ...
    }
}

And on the client side, I am invoking this method with:

$.connection.hub.start().done(function() {
    proghub.server.startProcessing(me.clientId);
});

I've enabled tracing on the Message bus and the message is received on all the servers:

SignalR.ScaleoutMessageBus Information: 0 : OnReceived(0, 54, 1)

However, the Hub method is invoked on only one server. How can I make this call execute the StartProcessing method on all servers?

It is not possible. The best way is to enable some kind of synchronization mechanism between servers. Since Redis is used as a backplane it can be also used as such mechanism.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM