Using SignalR 2.2.0, I would like some validation of observations concerning clients executing hub methods in a multi-server scale out setup.
I have SignalR running in a multi server model, using the SQL Server scaleout message bus.
When a client connects, the OnConnected
method of the Hub is called, as expected. I save the Context.ConnectionId
in static dictionary.
When the client later calls a method of the hub, it seems that another server in the farm is executing the hub method and not the server that originally ran the OnConnected method. The Context.ConnectionId
value in the hub method is correct, but it does not exist in the dictionary.
Is this the expected behaviour in the scale out model? If so, then I assume that I should be saving connection state data in database so that all Hub on all the servers will be able to look up the connection state based on the ConnectionId.
local
state, this information does not need to be shared. All we need is a backplane to transfer messages between servers. Do you have any specific requirements that need to share this information? – Khanh TO