What is the best way to use a SignalR service for my Blazor RenderMode.InteractiveServer app?

David Thielen 3,216 Reputation points
2024-07-09T17:37:42.7533333+00:00

Hi all;

I've read in numerous places that having my Blazor server use a SignalR service will let it handle a lot more simultaneous requests. So I want to add this. I've seen three very different ways describing how to do this:

  1. Write a ton of code
  2. Create a SignalR app
  3. Connect to a SignalR service
  4. Another approach???

I like option 3 best because it seems like a very clean way to accomplish this. But that does not mean it's the optimum approach.

So which is the optimum approach?

thanks - dave

Developer technologies | .NET | Blazor
Azure SignalR Service
Azure SignalR Service
An Azure service that is used for adding real-time communications to web applications.
0 comments No comments
{count} votes

Answer accepted by question author
  1. Bruce (SqlWork.com) 82,146 Reputation points Volunteer Moderator
    2024-07-09T18:30:24.97+00:00

    your question is not clear. does your Blazor app use signal/r for features not related to the Blazor Server circuit (example a chat app)? that what your links 1 & 2 refers to.

    the standard configuration is each webserver hosting your Blazor app is also the Signal/r Hub. But it can be configured to use the Azure Signal/r service (your link 3).

    using Azure Signal/R for the Blazor circuit has a couple pros:

    • it's a large farm and can handle a lot of connections (large scaling)
    • its geographical, so the client may have a faster connection, less latency
    • allow more connections if web host limits the number of websockets (ex: azure service apps). this is probably the main reason to use Azure Signal/R

    it also has some cons:

    • its a separate service so may add latency, especially for on-prem servers.
    • additional cost.

    Blazor server interactive will never match the scaling/performance of client interactive, except perhaps startup performance.

    in Blazor server interactive, every event is detected by JavaScript, sent to the server. the server process the event, and build a new render tree, a datagram of the render tree changes its sent to the client. the client updates its copy of the render tree, and then updates the browser dom. If your Blazor app was event tracking each character or mouse move, it's a trip to the server and back for each event.


1 additional answer

Sort by: Most helpful
  1. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.


    Comments have been turned off. Learn more

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.