← Chrome 160 reference · All APIs

v160 · web api · web bluetooth · enabled by default

Web Bluetooth: BluetoothRemoteGATTServer.maxWriteWithoutResponseSize

Adds the synchronous, read-only maxWriteWithoutResponseSize property and the maxwritewithoutresponsesizechanged event (with its onmaxwritewithoutresponsesizechanged handler) to BluetoothRemoteGATTServer. The property reports the largest payload in octets (negotiated ATT_MTU − 3) that writeValueWithoutResponse() can transmit in one ATT Write Command PDU, letting applications size high-throughput GATT chunks without hard-coding the 20-byte default or probing with failing writes.

Limited availability — Chromium-only (not Baseline)

  • Chrome · 160 (desktop, Android; see platform notes)
  • Edge · Chromium-based (mirrors Web Bluetooth; no BCD entry yet)
  • Firefox · Not implemented (position: negative)
  • Safari · Not implemented (position: oppose)

Not Baseline. The parent web-bluetooth web-feature is Limited availability per webstatus.dev (Chrome 70 desktop, Chrome Android 56, Edge 79; neither Firefox nor Safari implements Web Bluetooth). BCD api/BluetoothRemoteGATTServer.json does not yet list maxWriteWithoutResponseSize or maxwritewithoutresponsesizechanged (checked 2026-11-24).

at a glance

Shipped inChrome 160, listed under “Enabled by default” in the milestone=160 listing; implemented in Chromium CL 7879985 (merged 2026-11-13 at refs/heads/main@{#1743877})
Runtime flag / kill switchWebBluetoothMaxWriteWithoutResponseSize (status: "stable", public: true in runtime_enabled_features.json5); available as a Finch kill switch after launch
Prerequisite featureDepends on BluetoothRemoteGATTServer inheriting from EventTarget (ChromeStatus 5138797158334464)
Specification PRwhatwg/bluetooth PR #672 (open; PR preview)
IntentsIntent to Prototype; Intent to Ship
Tracking bugs40265040, 40686244, 40163619
Author samplestatic.januschka.com/i-40265040
ChromeStatus5177569273053184 — Web Bluetooth: BluetoothRemoteGATTServer.maxWriteWithoutResponseSize

why it exists

In Bluetooth Low Energy GATT, an ATT Write Command (writeValueWithoutResponse()) carries a 3-octet header (1-octet opcode plus 2-octet attribute handle), leaving ATT_MTU − 3 octets for the attribute payload. Before Chrome 160, Web Bluetooth exposed no way to inspect the negotiated ATT_MTU for an active connection: applications streaming firmware, audio, or sensor commands either hard-coded the 20-byte BLE 4.0 default (23 − 3), relied on OS heuristics, or probed with oversized writes that failed or silently truncated depending on the OS stack. Exposing maxWriteWithoutResponseSize directly on BluetoothRemoteGATTServer — paired with a change event when the negotiated MTU updates — matches how OS Bluetooth stacks expose connection-level MTU and lets apps safely use larger payloads (commonly 182–512+ octets) for higher throughput.

Source: ChromeStatus 5177569273053184; whatwg/bluetooth PR #672; Chromium CL 7879985.

Syntax

Chrome 160 extends BluetoothRemoteGATTServer (already an EventTarget in ChromeStatus 5138797158334464) with one read-only numeric attribute and one event handler attribute:

[Exposed=Window, SecureContext]
partial interface BluetoothRemoteGATTServer {
  readonly attribute unsigned short maxWriteWithoutResponseSize;
  attribute EventHandler onmaxwritewithoutresponsesizechanged;
};

This reference covers three parts of the contract: maxWriteWithoutResponseSize, onmaxwritewithoutresponsesizechanged, and the maxwritewithoutresponsesizechanged event & platform ATT_MTU updates.

Source: Chromium bluetooth_remote_gatt_server.idl; Web Bluetooth PR #672 preview.

BluetoothRemoteGATTServer.maxWriteWithoutResponseSize

Inputs. None (read-only getter on a BluetoothRemoteGATTServer instance obtained from device.gatt). Assigning to it silently fails in sloppy mode or throws a TypeError in strict mode.

Outputs. Returns an unsigned short (16-bit unsigned integer, range 20–65532) representing the largest byte sequence, in octets, that BluetoothRemoteGATTCharacteristic.writeValueWithoutResponse() can transmit in a single ATT Write Command PDU without fragmentation or rejection.

Source: Web Bluetooth PR #672 — maxWriteWithoutResponseSize; Chromium bluetooth_remote_gatt_server.h; web_bluetooth_service_impl.cc.

BluetoothRemoteGATTServer.onmaxwritewithoutresponsesizechanged

Inputs. Accepts an event handler function ((event: Event) => void) or null to clear the handler, following standard HTML EventHandler IDL attribute rules. Listeners can alternatively be registered via server.addEventListener("maxwritewithoutresponsesizechanged", listener).

Outputs. Returns the currently registered handler function or null. Invoked whenever a maxwritewithoutresponsesizechanged event is dispatched at that BluetoothRemoteGATTServer instance.

Source: Chromium bluetooth_remote_gatt_server.idl; bluetooth_remote_gatt_server.h; Web Bluetooth PR #672 preview.

maxwritewithoutresponsesizechanged event & platform ATT_MTU updates

Inputs & triggers. Dispatched by the user agent (not authored via inputs) when it observes an ATT_MTU change for the connected remote device (for example after an Exchange MTU procedure completes). In Chromium’s BluetoothRemoteGATTServer::MaxWriteWithoutResponseSizeChanged(), the browser queues a task on the Bluetooth task source, verifies connected_ is true and that the new value differs from the stored max_write_without_response_size_, updates the stored slot first, and then dispatches a plain Event("maxwritewithoutresponsesizechanged") (non-bubbling, non-cancelable).

Outputs. The Event object carries no custom payload property; listeners read event.target.maxWriteWithoutResponseSize (or server.maxWriteWithoutResponseSize) to get the updated octet limit. The specification guarantees the stored value never changes without firing the event while connected.

How Chromium observes ATT_MTU and fires maxwritewithoutresponsesizechanged across OS Bluetooth stacks (verified in CL 7879985)
Platform stackInitial MTU sourceLate MTU update / event timing
Android (BluetoothDeviceAndroid)Cached mtu_ (defaults to 23 → 20 if unnegotiated)OnMtuChanged() notifies adapter when Android reports an MTU exchange result
Windows (BluetoothDeviceWinrt)IGattSession::get_MaxPduSize()OnMaxPduSizeChanged() notifies adapter when WinRT updates session max PDU size
macOS (BluetoothLowEnergyDeviceMac)[peripheral maximumWriteValueLengthForType:CBCharacteristicWriteWithoutResponse] + 3 at connectCoreBluetooth has no dedicated MTU callback; Chromium re-polls on GATT callbacks (DidUpdateValue, DidWriteValue) via MaybeNotifyMtuChange()
Linux / ChromeOS BlueZ (BluetoothDeviceBlueZ)First GATT characteristic reporting an MTU (nullopt → 20 until discovery)BlueZ exposes MTU per characteristic, so the real value can arrive after service/characteristic discovery
Source: Web Bluetooth PR #672 — Responding to MTU Changes; bluetooth_remote_gatt_server.cc; bluetooth_device_android.cc; bluetooth_device_winrt.cc; bluetooth_low_energy_device_mac.mm; bluetooth_device_bluez.cc.

Lifecycle and state transitions

  1. Before first connect(): server.maxWriteWithoutResponseSize returns 20 (default ATT_MTU 23 − 3).
  2. On connect() resolution: Chromium overwrites max_write_without_response_size_ with the connection’s current negotiated size before resolving the promise — no maxwritewithoutresponsesizechanged event fires for this initial seed.
  3. While connected: If the OS stack later observes a different MTU (for example after service discovery on BlueZ or post-connect Exchange MTU on Android/Windows/macOS), Chromium updates maxWriteWithoutResponseSize and fires maxwritewithoutresponsesizechanged. Duplicate notifications with the same size are ignored.
  4. After disconnection: Updates arriving while server.connected is false are ignored (no event fires). In Blink’s CleanupDisconnectedDeviceAndFireEvent(), the cached integer is not actively reset on disconnect; reconnecting with connect() replaces it with the new connection’s value. Always guard writes on server.connected and re-read maxWriteWithoutResponseSize after reconnecting.
Source: Chromium bluetooth_remote_gatt_server.cc (ConnectCallback, MaxWriteWithoutResponseSizeChanged, CleanupDisconnectedDeviceAndFireEvent); Web Bluetooth PR #672 preview.

Errors, edge cases, and feature detection

Reading maxWriteWithoutResponseSize and assigning onmaxwritewithoutresponsesizechanged do not throw exceptions on valid BluetoothRemoteGATTServer instances. Key operational edge cases:

Source: ChromeStatus 5177569273053184 (ergonomics & interop risks); Web Bluetooth PR #672 preview.

Context and exposure

Exposed as [Exposed=Window, SecureContext] behind the WebBluetooth and WebBluetoothMaxWriteWithoutResponseSize runtime features. Not exposed in Web Workers or Service Workers. Obtaining a BluetoothRemoteGATTServer requires a secure context (HTTPS or localhost), a user gesture to invoke navigator.bluetooth.requestDevice(), explicit user device selection, and an allowed bluetooth Permissions Policy.

Source: Chromium bluetooth_remote_gatt_server.idl; ChromeStatus 5177569273053184.

Examples

No live demo is published on the Chrome Platform Showcase for this feature yet (checked 2026-11-24). The feature author’s standalone Web Bluetooth MTU sample is live at static.januschka.com/i-40265040.

Adaptive chunked transfer with maxWriteWithoutResponseSize and change events

async function streamPayload(serviceUuid, charUuid, payloadBytes) {
  const device = await navigator.bluetooth.requestDevice({
    filters: [{ services: [serviceUuid] }],
  });
  const server = await device.gatt.connect();

  // Feature-detect with a safe 20-byte fallback for older Chromium builds
  const getChunkSize = () => {
    const reported =
      typeof server.maxWriteWithoutResponseSize === "number"
        ? server.maxWriteWithoutResponseSize
        : 20;
    // Cap at 512 if targeting standard GATT attribute maximums
    return Math.max(20, Math.min(reported, 512));
  };

  let chunkSize = getChunkSize();

  // React if the OS stack observes a larger ATT_MTU later (e.g. after discovery)
  const onSizeChanged = () => {
    chunkSize = getChunkSize();
    console.log("Updated maxWriteWithoutResponseSize:", server.maxWriteWithoutResponseSize);
  };
  if ("onmaxwritewithoutresponsesizechanged" in server) {
    server.addEventListener("maxwritewithoutresponsesizechanged", onSizeChanged);
  }

  try {
    const service = await server.getPrimaryService(serviceUuid);
    const characteristic = await service.getCharacteristic(charUuid);

    // Re-read after service discovery (BlueZ may populate MTU at this point)
    chunkSize = getChunkSize();

    for (let offset = 0; offset < payloadBytes.byteLength; ) {
      if (!server.connected) {
        throw new Error("GATT server disconnected mid-transfer");
      }
      const step = chunkSize;
      const chunk = payloadBytes.subarray(offset, offset + step);
      await characteristic.writeValueWithoutResponse(chunk);
      offset += chunk.byteLength;
    }
  } finally {
    server.removeEventListener?.("maxwritewithoutresponsesizechanged", onSizeChanged);
  }
}
Source: Web Bluetooth PR #672 preview; Chromium bluetooth_remote_gatt_server.cc.

Using the onmaxwritewithoutresponsesizechanged event handler property

const server = await device.gatt.connect();

if ("onmaxwritewithoutresponsesizechanged" in server) {
  server.onmaxwritewithoutresponsesizechanged = (event) => {
    const gatt = event.target;
    console.log("Negotiated write-without-response limit (octets):", gatt.maxWriteWithoutResponseSize);
  };
}
Source: Chromium bluetooth_remote_gatt_server.idl; Web Bluetooth PR #672 preview.

Browser compatibility

Support for BluetoothRemoteGATTServer.maxWriteWithoutResponseSize and maxwritewithoutresponsesizechanged. BCD does not yet contain keys for these members; interim version data comes from ChromeStatus 5177569273053184 and Blink CL 7879985 alongside BCD base Web Bluetooth data (checked 2026-11-24).
BrowsermaxWriteWithoutResponseSizeNotes & evidenceBase BluetoothRemoteGATTServer (BCD)
Chrome (desktop, Android)160Enabled by default in ChromeStatus milestone=160 (CL 7879985, status: "stable"). ChromeStatus also lists WebView and iOS as 160, though BCD records Android WebView and iOS as unsupported for base Web Bluetooth and Linux desktop requires enabling Web Bluetooth.70 desktop (Linux behind flag), 56 Android
EdgeUnknownChromium-based; inherits Blink implementation once rebased to Chromium 160; no BCD entry yet79 (mirror)
FirefoxNoWeb Bluetooth not implemented; Mozilla standards position: NegativeNo
SafariNoWeb Bluetooth not implemented; WebKit standards position: OpposeNo
Source: BCD api/BluetoothRemoteGATTServer.json; ChromeStatus API record 5177569273053184; webstatus.dev web-bluetooth.

Security and privacy

maxWriteWithoutResponseSize and maxwritewithoutresponsesizechanged are exposed only on a BluetoothRemoteGATTServer belonging to a peripheral the user has already explicitly granted to the origin via navigator.bluetooth.requestDevice() inside a secure context. The API does not grant access to additional devices, services, characteristics, or write operations, and all existing Web Bluetooth blocklist, service allowlist, user-consent, and Permissions Policy (bluetooth) checks remain unchanged. The numeric size reveals a small amount of connection-level detail about the selected peripheral and host Bluetooth stack after consent and connection; ChromeStatus records WebBluetoothMaxWriteWithoutResponseSize as a post-launch kill switch if regressions occur.

Source: ChromeStatus 5177569273053184 (security_risks); Web Bluetooth — Security and privacy considerations.

Specifications

see also