Creating a Blazor project you need to decide on the Blazor hosting model
Microsoft provides two different hosting models, Blazor Server and Blazor WebAssembly, and depending on the purpose of the application one could be better than the other.
Both serve a purpose, but there is a major difference in what they can do and how well they perform in doing so. We’ll get into that.
Both can be used to develop desktop and web applications. The server version is suitable for developing large-scale enterprise applications, while the web version is more commonly used for developing small- to medium-sized applications.
This post explains the definitions of both hosting models, discusses the pros and cons of each, and concludes with a recommendation of when to use them.
The Blazor Server is a new hosting model for building web applications, and as such is not the same as other models. The Blazor Server is the server-side hosting model, meaning that the application will run and execute server-side. It will handle all the events and UI updates, and very little will be loaded to the client browser.
To communicate with clients, we need to create an asynchronous messaging layer to make sure things happen in the right order. To handle the communications between the client and server, Blazor Server uses the open-source library SignalR. SignalR helps us to make this all work. It has also helped us create a fully functional serverless experience.
SignalR is the bridge that connects the client-side with the server-side in the Blazor Server architecture.
Blazor has a built in framework that allows for communication between the client and the server. For example, it will allow a client to subscribe to a particular event that can happen on the server.
Blazor WebAssembly (2020) is the newest member of the Blazor family, coming after Blazor Server (2019) and works the opposite to his big brother. Blazor Server executes mostly server-side, Blazor WebAssembly does the opposite it run entirely on client-side.
In order to avoid having to establish new connections to the server, the application is delivered to the client as a web page instead of an application. This eliminates any connection overhead associated with fetching the code from the server.
The client-side approach is the preferred way of developing applications because the browser is already running on your device. As such, no additional bandwidth is required to transfer the finished product to your device.
Blazor is a new approach to developing web applications. It’s different from traditional ASP.NET and MVC frameworks in that it combines the best of both worlds to provide a truly mobile-friendly, powerful and secure experience. In addition, Blazor is fully functional client-side, which means that it’s 100% mobile-friendly.
Server vs WebAssembly
There are no one-size-fits all answers for web development. We must always consider our needs and the requirements of our project. Both ASP.NET Core and Blazor each have their own strengths and weaknesses. We can’t just pick one and say “that’s it, that’s what we’re using.” It’s up to us to weigh and compare the features that are offered by the two platforms.
When we’re building a new Blazor application, we have to make sure to choose a hosting option that best suits the application. It’s important to understand the needs of the application so that you can pick a solution that will best meet the needs. The best solution is one that best fits the needs of our application and will be able to scale for as long as we need it to.
Example Server vs WebAssembly
Creating a simple application to run in a location where internet connection is bad? Then Blazor WebAssembly is the choice for you because it works even without a server connection.
Need to manage business processes in real-time? Then Blazor Server is the best answer. Blazor Server is a great tool for developing and running a real-time application. But it requires constant connection to the backend to keep it up to date.