v157 · web bluetooth · needs hardware for the full path
Live server events
Attach listeners to a real GATT server object and watch which object each event actually fires on. Web Bluetooth needs a secure context, a user gesture, an adapter, and a device in range — the panel below reports exactly which of those this browser has, and nothing here fakes a success it did not observe.
Prerequisites, honestly
probing…
- navigator.bluetooth
- —
- server : EventTarget
- —
- Secure context
- —
- Adapter
- —
Connect and listen on the server
Opens Chrome's device chooser. Pick any BLE device in range. The page connects the GATT server, attaches addEventListener handlers on the server (new) and on the device (for comparison), reads nothing else, and writes nothing. Power the device off — or use its Disconnect button — to watch which listener fires.
- Device
- not connected
- server.connected
- —
- server events seen
- 0
- device events seen
- 0
Event log
- Nothing yet.
code path
const device = await navigator.bluetooth.requestDevice({
acceptAllDevices: true,
});
const server = await device.gatt.connect();
// NEW in 157 — the server speaks the standard listener API:
server.addEventListener("maxwritewithoutresponsesizechanged", (e) => {
console.log(e.target === server); // true — fires ON the server
rechunk(server.maxWriteWithoutResponseSize);
});
// Unchanged — disconnection still fires on the DEVICE:
device.addEventListener("gattserverdisconnected", (e) => {
console.log(e.target === device); // true
});