Simplified client-side architecture scheme
WebAssembly focuses mainly on CPU-intensive tasks and can be used successfully in:
Image, video, audio or CAD streaming and editing
Virtual reality (VR) and Augmented reality (AR)
Emulation or simulation platforms
Artificial Intelligence (AI)
VPN and remote desktop
Internet of Things (IoT)
Machine Learning (ML)
The very important thing is that WebAssembly is supported in all major browsers: Mozilla Firefox, Google Chrome, Safari, and Edge, what is necessary to fulfill its assumptions, such as portability. The major goal is to run WASM almost anywhere, from the browser to the server-side and also in embedded systems. WebAssembly has the same goal as the one that Java tried to achieve with Applets.
Because WASM is designed to be an effective compilation target for low-level source languages like C, C++, Rust, it is a natural choice to use one of these languages for creating WebAssembly modules. Why can it be a good choice? Because in these languages we managed memory manually, and the current version of WebAssembly does not support garbage collection at all.
However, it doesn't mean, that we cannot use other programming languages that use this functionality, such as Python, Go or C#. It will require us to use additional tools or interpreters that will implement the functionality of a specific language.
WebAssembly supported languages (third-party tools or interpreter required):
WebAssembly consists of two formats representing the same structures, but in different ways:
.wasm - binary format.
.wat - WebAssembly Text, a textual representation of the wasm binary format, uses S-expressions. This format is very helpful for debugging modules because it is used in browsers.
Our function looks like this:
and after compilation, we get this:
Now we can prepare the basic HTML structure in our index.html
Simplified AutoCAD application layers.
Another example of the possibilities offered by WebAssembly are Construct 3 which allows you to develop games and Figma which is a tool for designers. It is also worth mentioning PSPDFKit - an application for generating PDF documents and ACTIV Financial - the real-time and multi-asset financial market data and solutions provider.
A considerable inconvenience is also the fact that the browser debugger support isn’t really implemented yet.
Limitations (missing parts):
Single Instruction Multiple Data (SIMD)
ES modules integration
Wasm64 (support the wasm32 mode, with linear memory sizes up to 4 GiB)
So, is WebAssembly a technology for front-end developers? In my opinion, it is not. Of course, we will be using it but on a basis of API communication. WASM is a technology that definitely gives more space for backend developers to enhance performance and develop scalable web applications. The potential use of WebAssembly together with the two other web technologies looks very interesting, and for me, they perfectly complement each other.
The first combo is WASM with Progressive Web Apps (PWA). This is a quite obvious combination, considering the fact that PWA offers the user functionality similar to native applications for regular websites and web applications, e.g working offline.
The second one is WASM with Web Components. The combination of these two technologies gives developers the opportunity to create advanced HTML components. For a quick example, we will be able to develop a video player component with built-in codecs. Of course, this solution provides a wide variety of possibilities, like any file type viewers or even editors.
One of the most important advantages of WebAssembly is that it allows the developer to create web applications that will not differ from native desktop applications by their quality and performance. The cost of developing and maintaining the software itself will be lower compared to traditional applications. This is due to the fact that application distribution is limited to the browser and at the same time covers all possible operating systems. Also, the cost of transforming desktop applications into web applications should not be significant, because we can use the existing code and recompile it to the WebAssembly, the perfect example is Autodesk.
However, it should be kept in mind that WebAssembly is a relatively new technology and has limitations that definitely make it difficult to decide on its potential use.
The development and subsequent iterations of the WebAssembly should definitely be observed. However, I think that the possibilities of using it in current projects may be an ordinary overkill. According to my assessment, the use of WebAssembly makes sense only in strictly defined cases, mainly large scale applications.
Is an online IDE developed by Mozilla that can be used to compile C/C++ and Rust code into WebAssembly.
Is a .NET web framework based on C#, Razor, Mono, and HTML that runs in the web browsers via WebAssembly. Developers can write code in C# or VisualBasic.NET and compile them to normal .NET assemblies. The code will be run in a web browser using the WebAssembly based .NET runtime.
Simplified client-side architecture scheme