Skip to content

Disable non-websocket transports for Blazor Server #33775

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
danroth27 opened this issue Jun 22, 2021 · 11 comments · Fixed by #34644
Closed

Disable non-websocket transports for Blazor Server #33775

danroth27 opened this issue Jun 22, 2021 · 11 comments · Fixed by #34644
Assignees
Labels
area-blazor Includes: Blazor, Razor Components Done This issue has been fixed enhancement This issue represents an ask for new feature or an enhancement to an existing one feature-blazor-deployment Issues related to deploying Blazor feature-blazor-server
Milestone

Comments

@danroth27
Copy link
Member

Customers often have a bad time if they use Blazor Server with transports other than websockets. We should consider disabling non-websocket based transports for Blazor Server apps and provide a good error experience when websockets are not available.

@javiercn javiercn added area-blazor Includes: Blazor, Razor Components feature-blazor-server feature-blazor-deployment Issues related to deploying Blazor labels Jun 23, 2021
@pranavkm pranavkm added the enhancement This issue represents an ask for new feature or an enhancement to an existing one label Jun 24, 2021
@pranavkm pranavkm added this to the Next sprint planning milestone Jun 24, 2021
@ghost
Copy link

ghost commented Jun 24, 2021

Thanks for contacting us.

We're moving this issue to the Next sprint planning milestone for future evaluation / consideration. We would like to keep this around to collect more feedback, which can help us with prioritizing this work. We will re-evaluate this issue, during our next planning meeting(s).
If we later determine, that the issue has no community involvement, or it's very rare and low-impact issue, we will close it - so that the team can focus on more important and high impact issues.
To learn more about what to expect next and how this issue will be handled you can read more about our triage process here.

@pranavkm
Copy link
Contributor

FYI @BrennanConroy / @davidfowl

@BrennanConroy
Copy link
Member

We should consider disabling non-websocket based transports

If you do this you need to make sure that there is a way to opt back into other transports. You don't want to exclude those customers that can't run WebSockets for whatever reason.

Do you have ideas of how to surface clean errors for this or is there asks for SignalR to help here?

@danroth27
Copy link
Member Author

Some evidence of Blazor Server usage over non-websockets: https://twitter.com/HeyWellsy/status/1408275567489601540

@TanayParikh
Copy link
Contributor

provide a good error experience when websockets are not available.

@danroth27 Did you have anything in mind to ensure a 'good error experience'? Would a banner with a message like the following be appropriate?

image

@javiercn

@javiercn
Copy link
Member

@TanayParikh can you detect that the websocket failed to connect?

@TanayParikh
Copy link
Contributor

@TanayParikh can you detect that the websocket failed to connect?

Yep, I'm able to catch the following exception:

Error: Unable to connect to the server with any of the available transports. WebSockets failed: Error: 'WebSockets' is not supported in your environment.

Hence we can give a pretty specific error message about WebSockets being unavailable.

@BrennanConroy
Copy link
Member

I don't think that is the right error for this scenario. How did you get that?

@TanayParikh
Copy link
Contributor

I don't think that is the right error for this scenario. How did you get that?

Running a basic script in my browser (before page load) that does:

WebSocket2 = null;
WebSocket = null;

Is it possible to use:

for browser testing as well?

@BrennanConroy
Copy link
Member

Running a basic script in my browser (before page load) that does:

Ok, so that tests old un-supported browsers that don't support WebSockets at all. You also need to test connecting to a server that doesn't support WebSockets, which will be a slightly different error

for browser testing as well?

Yes

@TanayParikh
Copy link
Contributor

TanayParikh commented Jul 22, 2021

You also need to test connecting to a server that doesn't support WebSockets, which will be a slightly different error

I'm assuming this is with client side enforcing WebSockets transports layer, in which case I emulated that now via:

options.Transports = HttpTransportType.LongPolling

and got:

 Error: Failed to start the connection: Error: Unable to connect to the server with any of the available transports. LongPolling failed: Error: 'LongPolling' is disabled by the client.

I believe the underlying "ability" to detect WS not being available isn't hindered. Will ensure the final solution reflects both these use cases.

@ghost ghost added Done This issue has been fixed and removed Working labels Jul 27, 2021
@ghost ghost locked as resolved and limited conversation to collaborators Aug 26, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-blazor Includes: Blazor, Razor Components Done This issue has been fixed enhancement This issue represents an ask for new feature or an enhancement to an existing one feature-blazor-deployment Issues related to deploying Blazor feature-blazor-server
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants