← 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.
at a glance
| Shipped in | Chrome 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 switch | WebBluetoothMaxWriteWithoutResponseSize (status: "stable", public: true in runtime_enabled_features.json5); available as a Finch kill switch after launch |
| Prerequisite feature | Depends on BluetoothRemoteGATTServer inheriting from EventTarget (ChromeStatus 5138797158334464) |
| Specification PR | whatwg/bluetooth PR #672 (open; PR preview) |
| Intents | Intent to Prototype; Intent to Ship |
| Tracking bugs | 40265040, 40686244, 40163619 |
| Author sample | static.januschka.com/i-40265040 |
| ChromeStatus | 5177569273053184 — 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.
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.
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.
- Initial value:
20(defaultATT_MTUof 23 octets minus the 3-octet ATT Write Command header). - Connection seeding: When
server.connect()resolves, Chromium populates the internal slot from the platform’s current known MTU usingMath.max(mtu ?? 23, 23) - 3(seeMaxWriteWithoutResponseSizeFromMtu()inweb_bluetooth_service_impl.cc). - Synchronous read: Performs no Bluetooth I/O; returns the cached slot value synchronously.
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.
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.
| Platform stack | Initial MTU source | Late 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 connect | CoreBluetooth 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 |
Lifecycle and state transitions
- Before first
connect():server.maxWriteWithoutResponseSizereturns20(defaultATT_MTU23 − 3). - On
connect()resolution: Chromium overwritesmax_write_without_response_size_with the connection’s current negotiated size before resolving the promise — nomaxwritewithoutresponsesizechangedevent fires for this initial seed. - 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
maxWriteWithoutResponseSizeand firesmaxwritewithoutresponsesizechanged. Duplicate notifications with the same size are ignored. - After disconnection: Updates arriving while
server.connectedisfalseare ignored (no event fires). In Blink’sCleanupDisconnectedDeviceAndFireEvent(), the cached integer is not actively reset on disconnect; reconnecting withconnect()replaces it with the new connection’s value. Always guard writes onserver.connectedand re-readmaxWriteWithoutResponseSizeafter reconnecting.
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:
- Feature detection: Check
typeof server.maxWriteWithoutResponseSize === "number"(or"maxWriteWithoutResponseSize" in BluetoothRemoteGATTServer.prototype) and fall back to20in older Chromium builds. - Characteristic-level limits still apply:
maxWriteWithoutResponseSizebounds a single ATT Write Command packet, but Web Bluetooth’swriteValueWithoutResponse()still rejects withInvalidModificationErrororNotSupportedErrorif the characteristic lacks thewriteWithoutResponseproperty,NetworkErrorif disconnected, orInvalidModificationErrorif an application attempts a payload larger than the 512-byte GATT attribute limit (or larger thanmaxWriteWithoutResponseSize). Cap chunks withMath.min(server.maxWriteWithoutResponseSize, 512)if your peripheral enforces the standard 512-octet GATT attribute maximum. - Never wait indefinitely for the event: On platforms or peripherals where ATT_MTU never changes after connection,
maxwritewithoutresponsesizechangedwill never fire. Readserver.maxWriteWithoutResponseSizeimmediately afterconnect()and use the event only to upgrade chunk sizes dynamically.
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.
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
| Browser | maxWriteWithoutResponseSize | Notes & evidence | Base BluetoothRemoteGATTServer (BCD) |
|---|---|---|---|
| Chrome (desktop, Android) | 160 | Enabled 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 |
| Edge | Unknown | Chromium-based; inherits Blink implementation once rebased to Chromium 160; no BCD entry yet | 79 (mirror) |
| Firefox | No | Web Bluetooth not implemented; Mozilla standards position: Negative | No |
| Safari | No | Web Bluetooth not implemented; WebKit standards position: Oppose | No |
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.
Specifications
| Specification / artifact | Section |
|---|---|
| Web Bluetooth — whatwg/bluetooth PR #672 (open) | maxWriteWithoutResponseSize & Responding to MTU Changes (PR preview) |
| Web Bluetooth (Draft Community Group Report) | BluetoothRemoteGATTServer interface |
see also
- gendn Chrome 157 — Web Bluetooth: Make BluetoothRemoteGATTServer an EventTarget (prerequisite
EventTargetinheritance) - MDN —
BluetoothRemoteGATTServer - MDN —
BluetoothRemoteGATTCharacteristic.writeValueWithoutResponse() - Author sample — Web Bluetooth MTU / maxWriteWithoutResponseSize demo
- Chromium CL 7879985 — Implementation
- ChromeStatus — BluetoothRemoteGATTServer.maxWriteWithoutResponseSize (5177569273053184)