Web Bluetooth Write With/Without Response

Implements two APIs for writing to GATT characteristics that will allow an app to ignore a response from the device or to expect a response from the device. The currently implemented writeValue() method will remain for backwards compatibility, but is discouraged.

Motivation

Several issues have been found with the existing writeValue(value) method. 1. It does not allow the use to specify the type of GATT characteristic write that should be used. This is particularly a problem for devices that support both write types. Writing without response is often desirable for performance reasons, however on most platforms, writing with response is used by default. 2. The selection of writing with or without response is platform-specific. Currently most platforms will prefer writing with response, but Android preferes writing without response if both types are available on the GATT characteristic. 3. On most platforms, the current implementation depends on the device correctly reporting the available GATT characteristic write types via GATT characteristic properties. If these properties are not set, the characteristic cannot be written to. The new APIs address all of these issues while leaving the existing writeValue(value) as-is to preserve backward compatibility. The two new APIs allow the user to explicitly select writing with or without response. The new APIs also do not depend on the GATT characteristic properties being set correctly which can allow working around buggy Bluetooth devices.

Documentation

Specification

Editor's draft

Status in Chromium

Blink>Bluetooth


Enabled by default (tracking bug) in:

  • Chrome for desktop release 85
  • Chrome for Android release 85

Consensus & Standardization

After a feature ships in Chrome, the values listed here are not guaranteed to be up to date.

Owners

Search tags

Web Bluetooth, writeValue, writeWithoutResponse, writeWithResponse,

Last updated on 2020-10-25