State of Web Serial API In 2020

Viewed 2025

With the release of Chrome 77 the Web Serial API became available with the use of an experimental flag. This is particularly useful for desktop applications running in NW.js or Electron, where NodeJS has previously (and still does to a large degree) provided a bridge between web and native.

I find myself very much wanting to abandon the use of NPM packages like serialport, which extend both NW.js and Electron to provide serial port access.

While Electron 8.0.1 does make available navigator.serial, it's not exactly clear how much of the API is actually implemented. To further complicate things, there is no good documentation for the API (at least in my search) besides https://wicg.github.io/serial/ and https://github.com/WICG/serial/blob/gh-pages/EXPLAINER.md. I've tried tinkering with it on my own, but it's not clear whether I'm using it incorrectly, or whether parts simply aren't implemented.

So what is the status of this API? Which parts are reliably implemented (in Chromium), and is there any indication of when this will be ready for prime time? I think a lot of people are wondering this as it opens quite a few doors for interaction with the user's PC.

1 Answers

Here are some resources for tracking the status of the Serial API and its implementation in Chromium,

  • Draft Specification, as you've pointed out it is incomplete and I'm working on fixing that.
  • Specification "explainer", this is a less formal introduction to the specification and a more up-to-date reference for the current design of the API.
  • Chrome Platform Status entry, this tracks the official implementation status in Chrome.
  • Chromium implementation tracking issue, star this issue for updates as the implementation work progresses.
  • Polyfill library, this library uses WebUSB to implement the API for standard USB CDC class devices. Think of this at the moment as a prototype of what the API could look like when implemented in a browser.
  • Code lab, if you're looking for a larger example of how to use the API this code lab explains how to get started communicating with a particular device in a step-by-step fashion.
Related