Intent to Prototype: Web Bluetooth getDevices()

148 views
Skip to first unread message

Ovidio Ruiz-Henríquez

unread,
Feb 25, 2020, 3:05:43 PM2/25/20
to blink-dev
Contact emails

Design docs/spec


TAG review
Since this change adds an API that already exists in other device APIs, the TAG review process is skipped.

Summary
Chrome's implementation of Web Bluetooth does not have a way for websites to get a list of permitted devices. This feature adds a getDevices() API. getDevices() will return a list of BluetoothDevice objects that the current origin has been granted permission to use by the user.

Motivation
Not being able to query for a list of permitted devices without having to display a permission prompt has been a pain point of using the Web Bluetooth API. Instead, a site has to call navigator.bluetooth.requestDevice() and have the user choose a device from the device chooser prompt on every visit to the page. This is also annoying for users who have to deal with a permission prompt on every visit to the site. This is even more frustrating if the user has multiple Bluetooth devices to connect because the prompt can only grant permission to one device at a time.

We've had a couple of developers ask for this functionality in the bug for this feature.

Risks

Interoperability and Compatibility
The Web Bluetooth API as a whole has only been implemented in Chromium, therefore there is high interoperability risk. However, there are 170 tests in Web Platform Tests that other implementers can use.

Edge: Shipped
Firefox: No signals (based on discussion on standards-positions#95). There were concerns shared with WebUSB and WebMIDI, but ultimately the discussion ended without a distinct signal on the API.
Safari: No signals (bug)
Web / Framework developers: Mostly positive with concerns about security and privacy
  • Web Bluetooth API as a whole (see Intent to Ship: Web Bluetooth)
    • Mostly positive support on the WebKit bug
    • Privacy concerns several articles (12, 3)
    • Some positive support with security and privacy concerns on the Firefox bug
  • getDevices() API
    • Multiple users have requested the feature on the Crbug
Ergonomics
getDevices() should only need to be used within the Web Bluetooth API.

Activation
Developers would be able to use getDevices() as is.

Debuggability
No extra DevTools support is needed. Chromium has a bluetooth-internals page where developers can debug their Bluetooth devices. This page is accessed via chrome://bluetooth-internals in Chrome and edge://bluetooth-internals in Edge.

Will this feature be supported on all six Blink platforms (Windows, Mac, Linux, Chrome OS, Android, and Android WebView)?
No. It will be supported on all platforms that Web Bluetooth supports currently. which excludes Android WebView. See Web Bluetooth implementation status.

Is this feature fully tested by web-platform-tests?
Web platform tests will be added as this feature is implemented. The tests will use the Web Bluetooth testing API and will be added to the wpt/bluetooth directory.

Ovidio Ruiz-Henríquez

unread,
Feb 25, 2020, 3:06:30 PM2/25/20
to blink-dev
Link to entry on the Chrome Platform Status
Reply all
Reply to author
Forward
0 new messages