Chapter 5. Beyond the Browser

The main goal of WebAssembly was to allow the creation of high-performance applications on the web, using a range of programming languages. It was anticipated that people would use WebAssembly for video editing, CAD, Augmented Reality (AR)/Virtual Reality (VR) and various other computationally intensive tasks, and as we’ve seen in the previous chapters, this has been a success.

However, the WebAssembly specification was carefully designed to allow the integration into other, nonbrowser, environments. A WebAssembly module communicates with a host, but makes no assumptions about the nature of the hosting environment itself. The extent of WebAssembly adoption as a nonbrowser runtime has been greater than most initially envisaged. We cover some concrete examples later in this chapter, but first, let’s take a look at some of the features of WebAssembly that make it an appealing option as a runtime:

Secure

Modules execute within a sandboxed environment that is separate from the host runtime. This provides isolation in the case of faulty or compromised code. Even though this is an important requirement for execution of code delivered over the web, there are many other contexts for which isolation is also required.

Language and vendor independent

The WebAssembly specification was designed with a range of languages in mind, and while certain languages are easier to compile with the Minimum Viable Product (MVP) featureset, as new features such as garbage ...

Get What Is WebAssembly? now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.