Web Development With Blazor: Introduction (Part 3)
Blazor WebAssembly
Rather than operating
Blazor on a server, you can also execute it within your web browser through
WebAssembly. The WebAssembly variant of Blazor functions in a manner quite
similar to the server version.
A render tree is still
generated, and rather than executing the Razor pages on the server, they are
now executed within our web browser. Because WebAssembly lacks direct access to
the DOM, Blazor updates the DOM through direct JavaScript interoperation instead
of using SignalR.
Disadvantages Of Blazor
WebAssembly
- When compared to other major websites, the size of a Blazor WebAssembly is substantial, and it requires downloading many files.
- In order to utilize any on-site resources, it is necessary to create a Web API for access. Direct access to the database is not permitted.
- The code operates within the browser, indicating that it is susceptible to decompilation. This is a situation that all application developers are familiar with, but it may not be as typical for web developers.
Advantages Of Blazor
WebAssembly
- Given that the code operates within the browser, developing a Progressive Web App (PWA) becomes straightforward.
- As there are no applications running on the server, we can utilize any type of backend server or even a file sharing option (there's no requirement for a .NET-compatible server in the backend).
- The absence of round trips allows for quicker screen updates (which is why some game engines utilize WebAssembly).
Blazor WebAssembly versus
Blazor Server
It depends on which
option we should select. If you have an existing site that you want to migrate
to Blazor, opt for server-side. After you've completed the migration, you can
then decide whether you want to pursue WebAssembly as well.
If your website operates
on a mobile browser or an unreliable internet connection, you may want to
explore an offline-capable option using Blazor WebAssembly, as Blazor Server
requires a continuous connection. Although the initial load time for WebAssembly
can be somewhat sluggish, there are methods to integrate both hosting models so
you can enjoy the advantages of each.
Conclusion
A summary of the various
technologies compatible with Blazor is presented. This can assist individuals
in making a well-informed choice regarding which technology to select for their
upcoming project.
Comments
Post a Comment