What Is Blazor
The blazor world is made by two different words Browser and Razor when combined is called Blazor. It is a single-page application that runs or executes on the browser.
Blazor has two main types of hosting models.
- Blazor WebAssembly Application (WASM)
Blazor WASM is a single-page app (SPA) framework that builds an interactive client-side web app in .NET. The developer can handle any component to write code in .NET and C#, that's why blazor is a component-based application. It executes in any browser, basically blazor WSAM is a client-based application it's run on the client side.
- Blazor Server
Blazor server builds an interactive server-side web app in .NET. The developer can handle any component to write code in .NET and C#. basically, blazor server is a server-side application it's used for maintaining a server of an application.
For example, Blazor server application
What are the advantages of server application?
- The application executes within ASP.NET Core application on the server, hence all the .NET Core API is available for use along with its tooling capabilities.
- The Server only serves HTML and JavaScript to the client, not the .NET codebase.
- Significantly smaller download size and the application load much faster compared to WebAssembly.
- Thin client support, the application can be used with all types of browsers with or without WebAssembly support.
What are the disadvantages of server application?
- Every user interaction requires a trip to the server.
- The application will stop working if the connection is lost with the server.
- Handling multiple users is challenging as the server needs to manage multiple client connections and client states.
- ASP.NET Core server is required to serve the application making server-less deployment not possible.
For example, Blazor WebAssembly application
What are the advantages of webassembly application?
- The application can leverage the power of CPU and can give an almost native app-like performance.
- The application does not require the server to perform any of its operations. Once downloaded, the application is fully functional.
- As no ASP.NET Core Web Server is required to execute the application, it can be distributed using CDN making server-less deployment possible.
What are the disadvantages of webassembly application?
- The application takes a long time to load as the download size is larger.
- The application is restricted as per browser capabilities.
- A browser supporting WebAssembly can only execute the application.
- Debugging capabilities are currently limited.
Differences between Blazor webassembly and Blazor Server application
Conclusion
Anyone can switch to a new technology which is blazor, this is very important or mandatory to understand the differences between blazor server and blazor webassembly applications.