am working on chat application, using signal R.
I was wondering about when to use multiple hubs in signal r, what are the advantages, to use multiple hubs, or to use single hub is good approach?
am working on chat application, using signal R.
I was wondering about when to use multiple hubs in signal r, what are the advantages, to use multiple hubs, or to use single hub is good approach?
Per https://www.asp.net/signalr/overview/guide-to-the-api/hubs-api-guide-server#multiplehubs
There is no performance difference for multiple Hubs compared to defining all Hub functionality in a single class.
Therefore, it is simply a matter of deciding if you want to use multiple hubs to organize your code/functionality. OOP principals certainly apply, but it's a logical decision you have to make.
You should create a different one if it would serve a different purpose from your existing ones. You should follow the same approach you normally do in OOP - that is, a class should represent a logical unit.
Every new hub/connection you open will keep a live connection to the server. Each of those consuming network and processing resources. This is something important on mobile devices to prevent battery drain. I would keep a single hub whenever is possible. A single hub on the server can be used from different logical parts or layers of your code.