Chapter 7
Exploring the Internet of WebAssembly Things

The Internet of Things (IoT) is now as ubiquitous as the Internet itself. Some people see this as a tremendous opportunity for growth and innovation while others are terrified of an impending future dominated by millions of woefully underprotected, overconnected devices.

Today we have smart watches, refrigerators, toasters, doorbells, clothing, and thousands of other things that attach the real world to the digital world of the Internet. Infrastucture companies want to sell us platforms to support our IoT applications, security companies want to help us secure our smart devices, and the maker community is constantly expanding and building open source, connected hardware. IoT represents a nearly infinite number of ways to spend and earn money, so it’s no wonder it has inspired so much innovation.

As you’ve come to learn on your journey through this book, WebAssembly is about far more than just speeding up web applications. Its portable, compact format makes it ideal for systems under heavy disk, memory, and processing constraints. It’s ideal for isolating business logic from presentation and, as you’ll see in this chapter, from external, physical devices.

In this chapter, you’ll take advantage of WebAssembly’s portability and the Raspberry Pi’s easy access to hardware systems to build a pluggable host that separates the logic of determining what to display on a hardware indicator from the how of displaying it. The LED and computer parts for this chapter’s hardware are inexpensive, but even if you don’t have a Raspberry Pi, you’ll see how you can write and test code for hardware in isolation all from the comfort of your own workstation.

This chapter will operate on, and prove, the following two assumptions:

  1. If a WebAssembly module can be hosted in a web browser or a console application, you can host it on a Raspberry Pi

  2. If two WebAssembly modules adhere to the same contract, they can be interchanged like modular plugins

Before we start coding, let’s take a tour of a use case illustrating the problem we want to solve.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.220.237.24