Comments (10)
It looks that we can now forget about problems with Blazor Extensions SignalR and use Microsoft.AspNetCore.SignalR.Client directly - see "Support for the .NET SignalR client" section @ https://devblogs.microsoft.com/aspnet/blazor-webassembly-3-2-0-preview-1-release-now-available/
from signalr.
@szmalec Yes, the SignalR client is now supported on WebAssembly as expected.
One quick note... Before you blame "Blazor Extensions SignalR problems", please read the real reason why it has problems before start attacking others.
For future readers, the problem is caused because Blazor changed the way it deals with static content (CSS/JS) and that breaks every single extension out there making components useless.
As stated here we are working on bring a solution for this issue that doesn't requires manual interaction with JS/CSS files by the final user otherwise, it will not make any sense at all. It beats the purpose of a NuGet package in its essence.
from signalr.
In szmalec@0d8fe51 you can see modified Blazor.Extensions.SignalR
version which works OK after update to 3.1.0-preview4.19579.2
.
As you probably discover there are some drawbacks:
blazor.extensions.signalr.js
file is NOT automatically loaded in client application - new script entry entry had to be manually/explicitly added in wasm project intest\Blazor.Extensions.SignalR.Test.Client\wwwroot\index.html
:<script src="_content/Blazor.Extensions.SignalR.JS/blazor.extensions.signalr.js"></script>
app.UseStaticFiles();
had to be added totest\Blazor.Extensions.SignalR.Test.Server\Startup.cs
It looks that previously existed entry <EmbeddedResource Include="wwwroot\**\*.js" LogicalName="blazor:js:%(RecursiveDir)%(Filename)%(Extension)" />
in Blazor.Extensions.SignalR.JS.csproj
is not taken into account (is not used)?
Am I wrong at any of above points?
So if anyone wants to have 3.1.0-preview4.19579.2 and Blazor.Extensions.SignalR then can use my temporary solution.
Otherwise maybe it would be better to wait, because there are some currently unresolved issues which have "asset" in title, eg. for blazor-wasm-3.2-preview1...
from signalr.
Ran into the same issue, even managed to replace the BlazorExtensions.Storage with another solution before finding out what the root issue was.
I'd very much also appreciate a bit more elaborate (or dumbed down, if you will) set of workaround steps if anyone is able and willing. I haven't been able to locate another solution for doing SignalR in Blazor WASM.
from signalr.
It's just a temporary fix until the proper patch is merged in but you can compile the js manually and reference that from your index.html
(Here's mine if you're lazy, just change the extension to js blazor.extensions.signalr.txt)
from signalr.
I cannot find the Blazor.Extensions.SignalR.JS
file to put into my _content
folder. Where are you guys getting that? Everything makes sense except for that piece of the puzzle.
This issue is blocking my team from doing any work right now. Do we have any fixes? I tried following what you guys are talking about up above but I cannot reproduce your fix.
from signalr.
I was able to get around this issue by creating a new Razor Class Library, and adding: https://github.com/BlazorExtensions/SignalR/files/4007658/blazor.extensions.signalr.txt (renamed to .js) to RazorClasssLibrary\wwwroot\Blazor.Extensions.SingalR.js and adding the following:
<script type="text/javascript" src="_content/RazorClasssLibrary/Blazor.Extensions.SignalR.js"></script>
to index.html
Once I did this, it appears the websocket was at least connecting. (Although I don't have more information on if there is a better place to put this reference.)
from signalr.
Actually with all the changes made in @szmalec's branch everything works, even in WebAssembly. Is this project still maintained? Can we open a PR?
Are we waiting for blazor-wasm-3.2-preview1 to be released?
from signalr.
Are we waiting for blazor-wasm-3.2-preview1 to be released?
It looks like a SignalR client is scheduled for 3.2-preview3:
https://github.com/dotnet/aspnetcore/milestone/81
dotnet/aspnetcore#13503
from signalr.
@galvesribeiro
I didn't want it to sound like that. I know that SignalR Blazor Extensions should not be blamed for problems resulting from changes in the WASM Blazor - which is still in preview phase.
I just hoped that using the official SignalR client could be a better idea to bypass the likely temporary issues reported in this issue.
I know that SignalR Blazor Extensions is a piece of awesome work - thank you for your commitment and willingness to share the results of your hard work with the community!!
Now I also know that the recommendation of switching to the official Microsoft.AspNetCore.SignalR.Client in the WASM Blazor apps was not necessarily a good move (at least for now when blazor wasm is not officialy production ready), because after migration I encountered other problems (related to JWT auth) which I mention here (comment still not moderated - so not publicly available) ;)
So again - we should remember that Blazor WASM is still an alpha phase;)
from signalr.
Related Issues (20)
- Serverside example HOT 3
- JsRuntime on Server side HOT 1
- InvalidOperationException: JSRuntime must be set up correctly and must be an instance of JSRuntimeBase to use DotNetObjectRef. HOT 2
- Update to preview 8 HOT 1
- .net 3 preview 9 build error HOT 3
- Serialization Issue / Configuration HOT 6
- Cannot deserialize decimal with MessagePack and System.Text.Json HOT 1
- HubConnectionBuilder throws NullReferenceException HOT 6
- Support automatic reconnects and State on HubConnection HOT 4
- Non-generic overload of the On method? HOT 3
- Server Hub receives ValueTuple with default values HOT 2
- Why is this needed? HOT 1
- Preview 2 HOT 1
- Why JWT is being send in a query string parameter instead of its proper header? HOT 1
- Can't serialize poco class HOT 5
- Upgrading to .NET Standard 2.1 in the Blazor client-side project causes a runtime error HOT 1
- This might be obsolete now HOT 1
- examples needed
- How can we add support for Additional languages?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from signalr.