question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

AddServerSizeBlazor should return a builder

See original GitHub issue

This will make it more seamless to wire up scale out providers and other potential SignalR options. Today to wire up the service in preview 4 it looks like this:

services.AddServerSideBlazor().AddSignalR().AddAzureSignalR();

Alternatively, if we don’t want to expose the ISignalRBuilder then a more targeted builder might be useful if we want to add support for an AddAzureSignalR extension method anyways.

cc @rynowak @javiercn @SteveSandersonMS @danroth27 @bradygaster

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:2
  • Comments:12 (12 by maintainers)

github_iconTop GitHub Comments

2reactions
rynowakcommented, Apr 27, 2019

Discussed this in person with @davidfowl and we came up with the following plan.

This is a balance of:

  • Having the correct branding
  • Not leaking real implementation details
  • Not hiding SignalR

note: The fact that we use SignalR isn’t an implementation detail. Users need to know about it and care about it. However the fact that we use a type named BlazorHub is an implementation detail and we intend to hide it and make it non-public.

ConfigureServices

We will keep AddServerSideBlazor() and make it return it’s own builder type. We’ll accept callbacks of HubOptions so you can configure the hub. Configuring options specific to the hub we use is valuable.

We won’t return the ISignalRServerBuilder. The other methods supported on that type are GLOBAL for all SignalR usage. We don’t want to give the impression that those options only affect Blazor. Those other options are also things like adding protocols or redis scaleout. It’s important that users understand SignalR to do that.

The AddAzureSignalR() gesture is the most important one, and it’s going away.

Examples:

Vanilla

services.AddServerSideBlazor();

With Hub Options

services.AddServerSideBlazor(options =>
{
    options.MaximumReceiveMessageSize = long.MaxValue; // #YOLO
});

With Redis

services.AddServerSideBlazor(options =>
{
    options.MaximumReceiveMessageSize = long.MaxValue; // #YOLO
});
services.AddSignalR().AddStackExchangeRedis();

Configure

We will add a marker interface to the convention builder returned by MapHub<>. SignalR and Server-Side-Blazor will each define it’s own concrete type that applies this marker interface. This allows us to define unique functionality via extensions for vanilla-hubs, all signalr, and the blazor hub.

app.UseEndpoints(endpoints =>
{
    endpoints.MapHub<ChatHub>("/foo").DoABarrelRoll();
    endpoints.MapServerSideBlazor().AddComponent<App>("app");
});
1reaction
SteveSandersonMScommented, Apr 13, 2019

I’m not convinced that would help clarity. “SignalR Blazor” raises as many questions as it answers. It equally suggests “client-side Blazor that connects to a SignalR hub for whatever reason”.

There are lots of things that are different between the server and client hosting models. The term “server-side Blazor” encompasses all those and is the one thing customers have understood so far.

As for the Startup.cs code, I think either of Fowler’s options would be fine! I agree it’s good to maximise composability and not hide the SignalR config. Steve


From: Andrew Stanton-Nurse notifications@github.com Sent: Saturday, April 13, 2019 4:07:33 AM To: aspnet/AspNetCore Cc: Steve Sanderson; Mention Subject: Re: [aspnet/AspNetCore] AddServerSizeBlazor should return a builder that derives from ISignalRBuilder (#9316)

SignalR Blazor

Ok, so maybe it’s because I’ve spent a lot of time working on it and have a fondness for it, but that really clicks for me.

[ideas are happening]https://camo.githubusercontent.com/0ce2cd0d27ed1c485743867b93e6753a65430ee5/68747470733a2f2f6d656469612e67697068792e636f6d2f6d656469612f64796445536576454f716f3962444f5342462f67697068792e676966

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/aspnet/AspNetCore/issues/9316#issuecomment-482771136, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ABDOMlC4kcdHuXXa4PgrQ-c7xNGPYvY0ks5vgUn1gaJpZM4crgJp.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ASP.NET Core Blazor dependency injection
The builder variable represents a WebApplicationBuilder with an ... Should be reused within a component, as the transient lifetime is ...
Read more >
c# - How should I correct the registerations of my Scoped ...
I have a Blazor server app that is built on .NET Core 3.1. The app is working without problem. After I updated from...
Read more >
ASP.NET Core Blazor SignalR guidance
When the client attempts to create a SignalR connection, the client must reconnect to the same server. When more than one backend server...
Read more >
App crashes with "Server returned an error on close
The first time I am setting the MaximumReceiveMessgeSize and the second time I am doing this: builder.Services.AddServerSideBlazor().
Read more >
How to Build and Secure Web Applications with Blazor
Learn how to build client-side Web apps using Blazor and how to secure them with Auth0 authentication and authorization features.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found