4

Does web-bluetooth run into a 20 byte MTU on Windows Chrome?

I am seeing writes to a characteristic value of the same 25 bytes succeed in Chrome on mac OS and fail in Chrome on Windows.

As I whittle down the bytes, the error continues occurring until I reach 20 bytes. If this is the MTU, is it documented somewhere? And is there a way to write values >20 bytes?

I've tried the following, in TypeScript:

const writeBytesBuffered = async (
  characteristic: BluetoothRemoteGATTCharacteristic
  bytes: Uint8Array,
  index: number = 0
): Promise<void> => {
  while (index < bytes.length) {
    await characteristic.writeValue(bytes);
    index += 20;
  }
}

No errors are thrown but presumably my device's GATT server doesn't know what to do with them and fails silently.

ktusznio
  • 3,585
  • 3
  • 22
  • 21

0 Answers0