-
Notifications
You must be signed in to change notification settings - Fork 10.2k
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
Blazor Client-Side: Unable to create a SignalR connection in a C# Service #13503
Comments
Thanks for contacting us, @Z3roCoder. |
Thanks for your reply, I'm wondering - How expensive is the C#/JS Interop actually? And is it planned that Client Side Blazor will support the SignalR Client in the future? My goal actually was to achieve a constant data streaming from the server to the Client - As a sort of Log-Streaming, and I thought SignalR would be the way to go here. |
We'll be using this issue to track the work necessary to support SignalR client on Blazor Client-side. So yes, we expect that this will work at some point. |
Alright - Thank you for your fast response! I'll be looking forward to see this work! |
Hi @mkArtakMSFT - do you have any detailed explanation of why the SignalR .NET Core client is not compatible to be used with Client-side Blazor? |
I don't remember the exact reason, @ChristianWeyer, but this may be because of the lack of WebSocket support onthe underlying Mono platform. @SteveSandersonMS do I remember this right? |
@ChristianWeyer It's because .NET's built-in websockets APIs are built on underlying TCP networking APIs that can't ever work in the browser, since JavaScript doesn't expose raw TCP networking capabilities. This naturally leads to a runtime failure from somewhere low in the stack. What we have to do to make it work is provide a browser-compatible implementation of the relevant low-level websocket APIs that are implemented by calling the JavaScript websocket APIs. As it happens, this work has already been done. We just haven't integrated it yet. Once it is integrated, my expectation is that the SignalR client should just start working. |
Thanks for the update @SteveSandersonMS - great! |
@anurse is there a separate issue tracking this? Or should this one be used to track this work? |
I'm fine to use this issue. We should make sure it's in |
Is this work expected to release in core 3.2? Consider cases where a webapi is already written using the full framework. |
Yes, it will work in the 3.2 release. We have a plan for making it work. |
No, ASP.NET SignalR is not compatible with ASP.NET Core SignalR. |
@SteveSandersonMS @BrennanConroy anything remaining here? SignalR should be working for Blazor WASM apps (with some other bugs that are otherwise tracked). |
I think this can be closed |
I'll close it then! If anyone is seeing this kind of issue using SignalR Client on Blazor WASM, feel free to open a new issue! |
Awesome to see this resolved now! |
@Z3roCoder I assume you should simply use the .NET client, as described in the SignalR docs |
Describe the bug
I have set up a hosted Blazor Client-Side Application and have added a SignalR-Connection to my Server (Calling endpoints.MapHub("/somePath").
Now I tried to connect to this SignalR-Hub in a C#-Service in ClientSide-Blazor - However, this does not work as expected - I am receiving some strange Exception upon trying to call StartAsync on the HubConnection:
However, when trying to connect to the same hub through JavaScript, it works (as expected) flawlessly, so it's not a problem of my Hub or Server...
Expected behavior
The Connection should be able to be established without error
Screenshots
I attached some Screenshots with more Information.
The "StartIfNeededAsync"-Method is called on a Razor Page after a Buttonclick:
Additional context
Add any other context about the problem here.
Include the output of
dotnet --info
.NET Core SDK (gemäß "global.json"):
Version: 3.0.100-preview8-013656
Commit: 8bf06ffc8d
Laufzeitumgebung:
OS Name: Windows
OS Version: 10.0.17134
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\3.0.100-preview8-013656\
Host (useful for support):
Version: 3.0.0-preview8-28405-07
Commit: d01b2fb7bc
.NET Core SDKs installed:
2.0.2 [C:\Program Files\dotnet\sdk]
2.0.3 [C:\Program Files\dotnet\sdk]
2.1.202 [C:\Program Files\dotnet\sdk]
2.1.502 [C:\Program Files\dotnet\sdk]
2.1.503 [C:\Program Files\dotnet\sdk]
2.1.505 [C:\Program Files\dotnet\sdk]
2.1.507 [C:\Program Files\dotnet\sdk]
2.1.600-preview-009472 [C:\Program Files\dotnet\sdk]
2.1.700-preview-009597 [C:\Program Files\dotnet\sdk]
2.1.800-preview-009677 [C:\Program Files\dotnet\sdk]
2.1.800-preview-009696 [C:\Program Files\dotnet\sdk]
3.0.100-preview8-013656 [C:\Program Files\dotnet\sdk]
.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.1.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.1.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.1.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.1.11 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.1.12 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.1.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.1.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.1.11 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.1.12 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.0.0-preview7.19365.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.0.0-preview8.19405.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.0.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.0.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.6 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.11 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.12 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.0.0-preview7-27912-14 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 3.0.0-preview8-28405-07 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 3.0.0-preview7-27912-14 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 3.0.0-preview8-28405-07 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
The text was updated successfully, but these errors were encountered: