W3C home > Mailing lists > Public > public-web-bluetooth-log@w3.org > September 2018

[web-bluetooth] Observing characteristic notifications start and stop

From: Milan Raj via GitHub <sysbot+gh@w3.org>
Date: Tue, 04 Sep 2018 05:56:44 +0000
To: public-web-bluetooth-log@w3.org
Message-ID: <issues.opened-356662759-1536040603-sysbot+gh@w3.org>
rajsite has just created a new issue for https://github.com/WebBluetoothCG/web-bluetooth:

== Observing characteristic notifications start and stop ==
The startNotifications and stopNotifications effect all event listeners for a characteristic.

I have an event listener that closes around some state for buffering messages that come in. When notifications stop I want to be able to clean-up that state which involves resolving some pending promises.

As is some external factor can call stopNotifications or startNotifications and I don't see a native way to observe that change.

Some ideas:
1. Add event listeners for gatt characteristic value change notifications starting and stopping
2. Implement `characteristic.getNotifier` returns a reference to a GATTCharacteristicNotifier object that I use for registering event listeners instead of registering on the characteristic. I can start and stop notifications on the GATTCharactertisticNotifier instance without impacting other observers (and them impacting me)
3. Maybe not have startNotifications and stopNotifications? There is no equivalent parallel in the DOM space for disabling the event system. Seems like this idea has been previously rejected: https://github.com/WebBluetoothCG/web-bluetooth/issues/236

Please view or discuss this issue at https://github.com/WebBluetoothCG/web-bluetooth/issues/408 using your GitHub account
Received on Tuesday, 4 September 2018 05:56:45 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 4 September 2018 05:56:46 UTC