WebAssembly: The Definitive Guide

Book description

WebAssembly: The Definitive Guide is a thorough and accessible introduction to one of the most transformative technologies hitting our industry. What started as a way to use languages other than JavaScript in the browser has evolved into a comprehensive path toward portability, performance, increased security, and greater code reuse across an impressive collection of deployment targets.

Author Brian Sletten introduces elements of this technology incrementally while building to several concrete, code-driven examples of practical, cutting-edge WebAssembly uses. Whether you work with enterprise software or embedded systems, or in entertainment, scientific computing, or startup environments, you'll learn how WebAssembly can have a positive impact on the way you develop software.

  • Use WebAssembly to increase code portability across platforms
  • Reuse more of your software assets in a wider number of deployment targets
  • Learn how WebAssembly increases protection against prominent security attacks
  • Use WebAssembly to deploy legacy code in web environments
  • Increase your user base across languages and development environments
  • Integrate JavaScript code with other languages and environments to improve performance, security, and productivity
  • Learn how WebAssembly will affect your career as software developer

Publisher resources

View/Submit Errata

Table of contents

  1. Preface
    1. Conventions Used in This Book
    2. Using Code Examples
    3. O’Reilly Online Learning
    4. How to Contact Us
    5. Acknowledgments
  2. 1. Introduction
    1. What WebAssembly Offers
    2. History of the Web
    3. Origins of JavaScript
    4. Evolution of the Web Platform
    5. Native Client (NaCl)
    6. asm.js
    7. Rise of WebAssembly
  3. 2. “Hello, World!” (Sort of)
    1. WebAssembly Text Format (Wat)
    2. Converting Wat to Wasm
    3. Running Wasm in a Repl
    4. Running Wasm in the Browser
  4. 3. WebAssembly Modules
    1. Module Structure
    2. Exploring Module Sections
    3. Working with Modules
    4. Future ES6 Module Integration
  5. 4. WebAssembly Memory
    1. TypedArrays
    2. WebAssembly Memory Instances
    3. Using the WebAssembly Memory API
    4. Strings at Last!
  6. 5. Using C/C++ and WebAssembly
    1. Using C Functions
    2. Things Get Complicated
    3. C/C++ and WebAssembly
    4. Finally, “Hello, World!” in WebAssembly
  7. 6. Applied WebAssembly: Legacy Code in the Browser
    1. Proper “Hello, World!”
    2. Porting Third-Party Code
    3. libsodium
  8. 7. WebAssembly Tables
    1. Static Versus Dynamic Linking
    2. Creating Tables in Modules
    3. Dynamic Linking in WebAssembly
  9. 8. WebAssembly in the Server
    1. Native Extensions to Node.js
    2. WebAssembly and Node.js
    3. Supply Chain Attacks
    4. WebAssembly and Deno
    5. A Look Forward
  10. 9. Applied WebAssembly: TensorFlow.js
    1. Hardware
    2. Playground
    3. TensorFlow.js
    4. WebAssembly Backend
  11. 10. Rust
    1. Introduction to Rust
    2. Rust and WebAssembly
    3. wasm-bindgen
    4. Designing Code for In and Out of the Browser
  12. 11. WebAssembly System Interface (WASI)
    1. WebAssembly System Interface (WASI)
    2. Capabilities-Based Security
    3. The Bigger Picture
  13. 12. Extending the WebAssembly Platform
    1. WASI Runtimes
    2. Multi-Value Return
    3. Reference Types
    4. Module Linking
    5. Feature Testing
    6. Other Proposals
  14. 13. WebAssembly and .NET
    1. .NET and Wasmtime
    2. Blazor
    3. Uno Platform
  15. 14. Using AssemblyScript and WebAssembly
    1. “Definitely Not a TypeScript to WebAssembly Compiler”
    2. Simple Example
    3. Garbage Collection and the AssemblyScript Runtime
    4. AssemblyScript Standard Library
    5. AssemblyScript Loader
  16. 15. Applied WebAssembly: In the Cloud and on the Edge
    1. A Short, Personal Detour
    2. Our Industry Evolves
    3. Fastly Compute@Edge
    4. Krustlet
    5. Suborbital
    6. WasmEdge
    7. wasmCloud
  17. 16. Applied WebAssembly: Decentralized Applications
    1. Centralization Versus Decentralization
    2. From Bitcoin to Ethereum
    3. How Do You Solve a Problem Like the Halting Problem?
    4. ewasm
    5. Polkadot
    6. InterPlanetary File System (IPFS)
  18. 17. WebAssembly and Other Languages
    1. TinyGo
    2. Artichoke
    3. Swift
    4. Java
    5. Kotlin
    6. Zig
    7. Grain
    8. And Then?
  19. A. Installing WebAssembly Tools
    1. Installing WebAssembly Binary Toolkit (WABT)
    2. Installing LLVM
    3. Installing Emscripten
    4. Installing Wasm3
    5. Installing Wasmtime
    6. Installing Wasmer
    7. Installing Rust Tools
    8. Installing .NET Tools
    9. Installing AssemblyScript
    10. Installing IPFS
    11. Installing TinyGo
    12. Installing Artichoke
    13. Installing SwiftWasm
    14. Installing Zig and Grain
  20. Index
  21. About the Author

Product information

  • Title: WebAssembly: The Definitive Guide
  • Author(s): Brian Sletten
  • Release date: December 2021
  • Publisher(s): O'Reilly Media, Inc.
  • ISBN: 9781492089841