Software Development Blogs

Software Development

Blazor WebAssembly

Blazor allows developers to create single-page applications (SPAs) using C# and .NET utilising a component-based architecture. Blazor WebAssembly is a client-side in-browser implementation of Blazor which includes a .NET runtime implemented in WebAssembly.

Running .NET code inside web browsers is made possible by WebAssembly (wasm). WebAssembly is a compact bytecode format optimized for fast download and maximum execution speed. WebAssembly is an open web standard and supported in web browsers without plugins.

This type of application runs on the client in the browser with the help of WebAssembly. As soon as the application starts it downloads everything to the browser (HTML, CSS, and JavaScript files) and it also downloads the assembly (.NET Standard DLL) files required for the application.

So, once the application starts, it can work in offline mode, meaning, it doesn’t require the server. Because this type of application is composed of static files.

Create a new blazor webassembly app

ASP.NET Core hosted For API
Progressive Web Application for Mobile Phones

Project structure of blazor webassembly

Menifest.json for PWA App

HttpClient to call APIs

Run the application and inspect the downloaded files

All DLLs loaded on the browser

Pros:

Client-side Blazor is currently pre-compiled into intermediary language before it’s downloaded into browser and, as it development progresses, it will eventually be fully pre-compiled into WebAssembly.

Due to its compiled nature, it would probably be a lot faster than the equivalent logic from JavaScript. While it won’t make much visible difference for simple calculations, it will provide a tremendous benefit for performance-intensive applications.
1. No need for a server side
2. No need for JavaScript
3. Offline Support
4. Progressive web app

Cons:
Client-side Blazor is faster but it requires its whole environment to be downloaded, which may be quite hefty.
1. Big download size
2. Require WebAssembly
3. Debugging is not great
4. Your DLLs are downloaded

Next: Server Side Blazor

Leave a Reply