Trying to read in subscription callback fails
See original GitHub issueVersion
Tell us which versions you are using:
- react-native-ble-manager: 3.3.0
- react-native: 0.44.0
- Android, Nexus 5X
Expected behaviour
Doing a read in the callback of a subscription should be succesful
Actual behaviour
The read always fails, so I have to retry it in the catch
statement with a timeout, then it works. It seems that the BLE is “busy” and thus is not ready to read yet. I don’t know if it is the peripheral or the Android BLE manager that is not ready yet.
Steps to reproduce
- Subscribe to a characteristic
- In the callback for the subscribe event, read the same characteristic
Stack trace and console log
It just says, read failed.
Issue Analytics
- State:
- Created 6 years ago
- Comments:11 (11 by maintainers)
Top Results From Across the Web
javascript error inside subscribe callback - Stack Overflow
now lets assume sometime I get data as null and i tried to access it as res.data[0].some_property then it will throw js error...
Read more >What might cause the delay of the subscription callback? #27
It's possible that the Lambda times out and a well formed response isn't being sent back to the AppSync resolver. Again, with Lambda...
Read more >Subscriptions - Apollo GraphQL Docs
Allows the registration of a callback function, that will be triggered when the useSubscription Hook / Subscription component completes the subscription.
Read more >Why You Should Not Put Any Logic in the RxJS Subscribe ...
For the reactive approach, it is trickier. First, we need to set up a third observable to display the errors. Then, we use...
Read more >Subscribe Arguments - RxJS
In short we deprecated all signatures where you specified an anonymous error or complete callback and passed an empty function to one of...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi @marcosinigaglia , I might spot a possible cause.
In line 404 @ Peripheral.java, we have codes like this:
This call flow uses
writeDescriptor
in a synchronous manner. However, from Android doc https://developer.android.com/reference/android/bluetooth/BluetoothGatt.html, we can see thewriteDescriptor
just returns whether the operation isinitialied
and the actual result comes fromonDescriptorWrite
callback.I will try to fix this and report it later 😃
@whitedogg13 that’s great! Well done!