To have multiple hubs for one page, you donβt have to do anything, just create another hub class.
So that you can receive messages from the hub as a whole, be sure to register the client side method for the hub before starting your connection.
Therefore, if you want to use multiple hubs, all you have to do is have client methods for the hubs that you want to subscribe to before starting your connection.
No matter how many nodes you are subscribed to, they all use the same connection, which is pretty nice :).
To eliminate the problem associated with the need to "subscribe" to the hub after starting the connection, you will not be able to. An alternative would be to always subscribe to both hubs and use groups to control the sending of data. You can learn more about groups here: http://www.asp.net/signalr/overview/signalr-20/hubs-api/working-with-groups
source share