locked
Is there any problem with multiple connections to the same hub method on one page? RRS feed

  • Question

  • User-1158769213 posted

    I'm using ASP.NET Core MVC, and would like to split one of my pages down into several partial views. 

    At the moment, I create a SignalR connection, and have one callback function that updates various part of the page. When I split the page, some of the elements that need updating will be in one partial view, and others will be in a separate partial view.

    Is there any problem in each partial view creating its own connection and calling its own function? That way I can keep each one independent.

    Thanks for any advice you can give.

    Sunday, July 28, 2019 3:57 PM

Answers

  • User283571144 posted

    Hi Yossu,

    Short answer: No problem with multiple connections to the same hub method.

    According to the SignalR multiple hubs article:

    You can define multiple Hub classes in an application. When you do that, the connection is shared but groups are separate

    All clients will use the same URL to establish a SignalR connection with your service ("/signalr" or your custom URL if you specified one), and that connection is used for all Hubs defined by the service.

    There is no performance difference for multiple Hubs compared to defining all Hub functionality in a single class.

    There no performance difference if you create mutiple hubs and single hubs with multiple functions. 

    Best Regards,

    Brando

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, July 29, 2019 5:23 AM

All replies

  • User283571144 posted

    Hi Yossu,

    Short answer: No problem with multiple connections to the same hub method.

    According to the SignalR multiple hubs article:

    You can define multiple Hub classes in an application. When you do that, the connection is shared but groups are separate

    All clients will use the same URL to establish a SignalR connection with your service ("/signalr" or your custom URL if you specified one), and that connection is used for all Hubs defined by the service.

    There is no performance difference for multiple Hubs compared to defining all Hub functionality in a single class.

    There no performance difference if you create mutiple hubs and single hubs with multiple functions. 

    Best Regards,

    Brando

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, July 29, 2019 5:23 AM
  • User-1158769213 posted

    Thanks, didn't think there was, but wanted to be sure.

    Monday, July 29, 2019 12:47 PM