locked
SignalR and session affinity RRS feed

  • Question

  • User-1143580013 posted

    Details:

    • 2 IIS servers in AWS using elastic load balancer.
    • WEB Sockets configured on win 2012 r2. 
    • Both Servers have the same site running SignalR
    • A backplane is configured using Redis
    • Client is a windows forms app on windows 7. (uses serverSentEvents as transport)
    • The Hub sends a message to a specific client by connectionid
    • I Need the client to RESPOND to the SAME server. Some type of affinity.
    • I have the call to the client working.
    • I have the RESPONSE call to the hub working (see code below)
    • Problem: The RESPONSE goes to to any server in the web farm, not the same one that sent the original message

    How do I ensure the client RESPONDS to the same server in the web farm?

    Server Routine in Hub

    public class MyHub : Hub
    {
        public void RoutineOnMyHub(object myObject)
        {
            //do work
        }
    }

    Client Code:

    _Hub.Invoke("RoutineOnMyHub", myObject);
    Wednesday, February 10, 2016 10:38 PM

All replies

  • User614698185 posted

    Hi James Bailey,

    You can use a backplane to connect all the servers in your web farm to a single message bus, please see:   http://www.asp.net/signalr/overview/performance/scaleout-in-signalr

    And if you want to send to a specific connection, you could refer to this link:

    https://github.com/SignalR/SignalR/wiki/PersistentConnection

    Best Regards,

    Candice Zhou

    Thursday, February 11, 2016 8:30 AM
  • User-1143580013 posted

    Hi Candice, thank you for responding. Per the details above there is a backplane configured already. I'm not having trouble broadcasting to a client. I'm having trouble RESPONDING from the client back up to the hub. Or to put it a different way, I'm having trouble identifying messages relayed back to the hub from a client by a specific server. 

    Thursday, February 11, 2016 9:24 PM