Intent to Experiment: Serial API

405 views
Skip to first unread message

Reilly Grant

unread,
Oct 16, 2019, 12:42:38 PM10/16/19
to blink-dev

Contact emails

rei...@chromium.org


Explainer

https://github.com/WICG/serial/blob/gh-pages/EXPLAINER.md


Spec

https://wicg.github.io/serial 


Draft specification text (pending review) is at https://reillyeon.github.io/serial and more closely matches what is implemented currently in Blink.


TAG Review (Requested)

https://github.com/w3ctag/design-reviews/issues/431


Summary

The Serial API provides an interface for connecting to serial devices, either through a serial port on the user’s system or removable USB and Bluetooth devices that emulate a serial port. This API has been requested by the hardware developer community as a companion to the WebUSB API because operating systems require applications to communicate with USB-based serial ports using their higher-level serial API rather than the low-level USB API. It also supports non-USB serial ports.


Input and output are handled by the Streams API. The permissions model and settings UI follow the model defined by the WebUSB API. The user must select a particular port for the site to be granted permission. Permission can be revoked by clicking on the lock icon in the Omnibox or by visiting Chrome settings. An icon is shown in the tab while the connection is active. Permissions are not currently persisted between browsing sessions but I know this will be a user pain point and so a model similar to WebUSB and Web Bluetooth is envisioned.


The functionality currently available behind a flag and this experiment represents a minimum-viable-product for this API. Issues are filed in the Blink>Serial component for remaining work.


Link to feature tracking bug

https://bugs.chromium.org/p/chromium/issues/detail?id=884928


Link to Chrome launch approval bug (sorry, Googlers only)

https://bugs.chromium.org/p/chromium/issues/detail?id=967863


Link to “Intent to Implement” blink-dev discussion

https://groups.google.com/a/chromium.org/d/msg/blink-dev/GcqEnSW5yHs/r7G3iMmDCQAJ


Goals for experimentation

We have already received some feedback on the API surface and implementation from developers who have tried it behind a flag. The goal for this Origin Trial is to allow sites currently employing workarounds for access to hardware devices to deploy a Serial API-based approach to their users and compare the experience and functionality.


We expect to react to developer feedback and work on completing the implementation during the experiment period.


Sites such as the Espruino IDE are already ready to participate in the Origin Trial. Other projects such as avrgirl-arduino are in the process of porting from the Node SerialPort API to the web API.


Experimental timeline

The experiment begins with the release of Chrome 79 to beta-channel and ends when Chrome 82 is shipped to stable-channel (replacing Chrome 81 which will be the last version with the experiment enabled).


Any risks when the experiment finishes?

This API allows sites to deprecate alternative solutions for communicating with hardware devices, such as requiring a local WebSocket server to service as a bridge to the native operating system API. Sites experimenting with the Serial API should not remove support for these existing methods until it is fully shipped. New sites built without a fallback mechanism should be aware that this is experimental functionality that is not guaranteed to be available after the experiment ends.


Ongoing technical constraints

None.


Debuggability

Developers are able to debug script using this feature using the existing DevTools console and debugger. For debugging device communication issues it is often convenient to use the ReadableStream.tee() method to split the streams going to or from the device and print them to the console for inspection.


Will this feature be supported on all five Blink platforms supported by Origin Trials (Windows, Mac, Linux, Chrome OS, and Android)?

This feature will be available on all desktop platforms (Windows, macOS, Linux and Chrome OS). It will not be available on Android or Android WebView because the Android platform SDK does not include support for serial ports. On Android support for USB-based serial ports is possible using the WebUSB API and a polyfill. The permissions UX will be essentially the same for either API.


Link to entry on the feature dashboard

https://chromestatus.com/feature/6577673212002304


Links to demos

https://googlechromelabs.github.io/serial-terminal/

https://www.espruino.com/ide/


Yoav Weiss

unread,
Oct 17, 2019, 2:42:35 PM10/17/19
to Reilly Grant, blink-dev
LGTM

--
You received this message because you are subscribed to the Google Groups "blink-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/CAEmk%3DMbHjnjAtLDfBbbK9GugNgU4AtJJZ_0Eaz%3DUrGxO2t4w2A%40mail.gmail.com.

Reilly Grant

unread,
Oct 23, 2019, 1:10:24 PM10/23/19
to blink-dev
The changes necessary to enable this Origin Trial missed the branch point for Chrome 79 so I am updating the experiment timeline.

On Wed, Oct 16, 2019 at 9:41 AM Reilly Grant <rei...@chromium.org> wrote:

Contact emails

rei...@chromium.org


Explainer

https://github.com/WICG/serial/blob/gh-pages/EXPLAINER.md


Spec

https://wicg.github.io/serial 


Draft specification text (pending review) is at https://reillyeon.github.io/serial and more closely matches what is implemented currently in Blink.


TAG Review (Requested)

https://github.com/w3ctag/design-reviews/issues/431


Summary

The Serial API provides an interface for connecting to serial devices, either through a serial port on the user’s system or removable USB and Bluetooth devices that emulate a serial port. This API has been requested by the hardware developer community as a companion to the WebUSB API because operating systems require applications to communicate with USB-based serial ports using their higher-level serial API rather than the low-level USB API. It also supports non-USB serial ports.


Input and output are handled by the Streams API. The permissions model and settings UI follow the model defined by the WebUSB API. The user must select a particular port for the site to be granted permission. Permission can be revoked by clicking on the lock icon in the Omnibox or by visiting Chrome settings. An icon is shown in the tab while the connection is active. Permissions are not currently persisted between browsing sessions but I know this will be a user pain point and so a model similar to WebUSB and Web Bluetooth is envisioned.


The functionality currently available behind a flag and this experiment represents a minimum-viable-product for this API. Issues are filed in the Blink>Serial component for remaining work.


Link to feature tracking bug

https://bugs.chromium.org/p/chromium/issues/detail?id=884928


Link to Chrome launch approval bug (sorry, Googlers only)

https://bugs.chromium.org/p/chromium/issues/detail?id=967863


Link to “Intent to Implement” blink-dev discussion

https://groups.google.com/a/chromium.org/d/msg/blink-dev/GcqEnSW5yHs/r7G3iMmDCQAJ


Goals for experimentation

We have already received some feedback on the API surface and implementation from developers who have tried it behind a flag. The goal for this Origin Trial is to allow sites currently employing workarounds for access to hardware devices to deploy a Serial API-based approach to their users and compare the experience and functionality.


We expect to react to developer feedback and work on completing the implementation during the experiment period.


Sites such as the Espruino IDE are already ready to participate in the Origin Trial. Other projects such as avrgirl-arduino are in the process of porting from the Node SerialPort API to the web API.


Experimental timeline (updated)
The experiment begins with the release of Chrome 80 to beta-channel and ends when Chrome 83 is shipped to stable-channel (replacing Chrome 82 which will be the last version with the experiment enabled).

Reilly Grant

unread,
Mar 30, 2020, 1:46:03 PM3/30/20
to blink-dev
Due to the cancellation of Chrome 82 this Origin Trial will continue through Chrome 83.
Reply all
Reply to author
Forward
0 new messages