Check out a free preview of the full A Tour of Web Capabilities course

The "Web Serial & Web USB" Lesson is part of the full, A Tour of Web Capabilities course featured in this preview video. Here's what you'd learn in this lesson:

Max discusses the Web Serial API, which communicates with serial devices connected to a user's computer via USB, Bluetooth, or another serial connection. Another low-level API, Web USB, is also discussed in this lesson.

Preview
Close

Transcript from the "Web Serial & Web USB" Lesson

[00:00:00]
>> Web Serial, this one is even more low-level. It's a very low-level API that will let you communicate with any serial device connected to your computer. This is for computer, desktop computer, not phones, okay? USB, Bluetooth, or whatever serial you have, whatever connection you have, okay? This is a very, very low-level.

[00:00:23]
It's built on top of the existing serial protocol, okay? So every operating system supports that. It requires user's permission, of course, to receive and send data. Who is using web serial directly? Not a lot of devices. And this is the one that Apple says, I don't know why we are doing this, okay?

[00:00:44]
So there are a couple of scenarios, mostly for drivers, to update devices. But for that, instead of Web Serial, we also have Web USB. Web USB, it's another low level API that is targeted to device vendors, not to normal web developers, why? Because in this case, the device shouldn't be registered by the OS with the driver.

[00:01:11]
So you connect a new device and the OS doesn't know what that is, okay? Well, you can go to a website, and that website can connect to that USB device based on the firmware. So communication with your USB devices with the computer. And then you can read and write data directly without the need for custom drivers or software installed in your computer.

[00:01:37]
So you can use this to update the firmware of a device, or use the device without any kind of driver. So you probably won't be using this API unless you work at the hardware company, and this is Chromium only. So if you're thinking why Web Serial and Web USB were created, this is just my opinion.

[00:02:01]
But we need to remember that Google Chrome has also an operating system, Chrome OS, that is the operating system empowering Chromebooks. And on Chromebooks, sometimes, you don't have a full Linux operating system for the user. There is a Linux behind the scenes, or at least part of it.

[00:02:21]
But the idea was to add APIs to the web that can solve some problems, such as connecting to a special 3D printer that yeah has no software driver for Chromebooks, but still you can use it from a web app. Okay, that's kind of idea, it's a very low-level API.

[00:02:42]
It will, of course, require user's permission to access these devices. You communicate device settings, you can update the firmware and access all the device data with a very low-level API, binary data.

Learn Straight from the Experts Who Shape the Modern Web

  • In-depth Courses
  • Industry Leading Experts
  • Learning Paths
  • Live Interactive Workshops
Get Unlimited Access Now