Re: [web-bluetooth] Generate 'characteristicvaluechanged' events without waiting for a CCCD update (#514)

👍  for having this API match reality. Do you think it'd make sense to ask developers to explicitly opt into unsolicited notifications and indications? For example:

```js
const device = await navigator.bluetooth.requestDevice({ filters: [{ services: [serviceUuid] }] });
device.addEventListener('characteristicvaluechanged', () => { ... });
device.gatt.deliverUnsolicitedNotifications = true;
const server = await device.gatt.connect();
const service = await server.getPrimaryService(serviceUuid);
const characteristic = await service.getCharacteristic(characteristicUuid);
await characteristic.startNotifications();
```

Without that, I worry a bit that a device could attack a page by sending unexpected notifications ... maybe if the device runs multiple apps each constrained to their own service...

-- 
GitHub Notification of comment by jyasskin
Please view or discuss this issue at https://github.com/WebBluetoothCG/web-bluetooth/issues/514#issuecomment-690795474 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Friday, 11 September 2020 00:06:52 UTC