4 ms·
There are two major flavors of Blazor: Server and WASM. Server is considerably easier to program with because it removes the complexity of making REST calls to
by RagnarD 3y ago
There are two major flavors of Blazor: Server and WASM.
Server is considerably easier to program with because it removes the complexity of making REST calls to a server component. It creates an illusion of seamless coupling between browser client and server methods. In reality, internet delay makes Blazor Server UIs unacceptably slow because UI interaction often results in a round trip call across the net. As well, every browser connection consumes significant resources on the server.
WASM is more difficult because of the need to use REST calls (typically) from a client project to the server side project. But the client side can be nearly entirely written in C#, targeting WASM and running in the browser - even including powerful .NET libraries (see NuGet repo.) The server code implements client services. Note that this should all sound very familiar with conventional web apps, except that a radically superior language is used instead of Javascript on the client side.
The ProTip is this: if you can make the choice, choose WASM. Even for an intranet app and despite the additional dev work.
- arielcostas 3y agoAlso, since .NET 8 (which will be released next month), there is a new way of using Blazor which combines "normal" SSR (same you'd get with ASP.NET MVC or Razor Pages), Server/WASM functionality and stream rendering. Meaning you'll be able to get the best of all worlds (SSR speed and SEO, and Server/WASM interactivity), all at in one place.
- oaiey 3y agoAnd there is Blazor Hybrid. Which is basically a electron shell / Cordova approach where a web view hosts the UI and the rest is in the regular .NET process on windows, Android, Mac and iOS. Maybe Linux not sure. It is currently a minimum of 4-5 different modes. Blazor is a beast.
- oaiey 3y agoCareful with radical superior. Even as a .NET fanboy I have to respect 2023 JavaScript/ TypeScript.
- graboid 3y agoI agree that WASM is the better option. In my opinion it is however not viable for public-facing sites. The bundle size even if you pull all the tricks is just too big. I am talking about having to download >1MB in the best case before the site is functional. Simply unusable on slow mobile connections. React/Vue/etc. are often sub 100kB, you can even have something like Preact.js at 3kB if you want. I don't understand why this is seemingly not given more priority at MS: https://github.com/dotnet/aspnetcore/issues/41909 https://github.com/dotnet/aspnetcore/issues/41909 My prediction is that this will kill off the technology if they don't find a solution.