← Back to release summary

Web Bluetooth Write With/Without Response

Category
Device
Type
New or changed feature
Status
Enabled by default (Chrome 85)
Intent stage
Evaluate readiness to ship

Summary

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.

Standards & signals

Docs: https://github.com/WebBluetoothCG/web-bluetooth/issues/238

Explainers: This is a small modification to an existing feature, so there is not a full explainer doc. Motivation/design has been discussed at https://github.com/WebBluetoothCG/web-bluetooth/issues/238.

View on chromestatus.com