react-native-ble-plx icon indicating copy to clipboard operation
react-native-ble-plx copied to clipboard

How can one ensure (wait for) characteristic subscription has been finished?

Open sskorokhodov opened this issue 4 years ago • 1 comments

Hi guys,

Thank you very much for the brilliant RN component!

I'm trying to avoid a race condition when I subscribe to characteristic notifications. Right after, I write to another characteristic. Then I wait for notification about it from the first one as a result. I don't get the notification If the subscription is established after the write.

Right now, I haven't found any way to wait until the subscription has been established (i.e., the phone received a response from the peripheral about a successful subscription).

Also, I'm not sure that I've chosen the right approach. One solution could be to always send a notification with the current characteristic value when a subscription request is received by the peripheral. The phone can then proceed thereafter. But that requires changing the peripheral, which is not always possible.


  • [x] I am running the latest version
  • [x] I checked the documentation and found no answer
  • [x] I checked to make sure that this issue has not already been filed
  • [x] I'm pretty sure that question is related to the library itself and not Bluetooth Low Energy or Classic in general.

sskorokhodov avatar May 25 '21 13:05 sskorokhodov