Open olivierklaver opened 4 years ago
Sorry to bother you almost four years later, did you find a workaround for this issue? The issue does not seem to happen on my Windows machine but still seems to be a problem on Mac.
MacOS: 15.0.1 (24A348) Chrome: Version 130.0.6723.70 (Official Build) (arm64)
Funny that you ask about this now, as I happened to revisit that part of the code yesterday and thought to myself, I wonder if this is still an issue in Chromium today! For me this issue only occurred with a specific heart-rate sensor that would sometimes disconnect after (and during) the initialization process. I ended up giving users the option to remove the sensor in the device manager of my app. But yea that is not a work-around just taking the L and moving on I guess. Could you tell me the sensor type, brand, and model you’re experiencing this issue with?
This is actually happening with a Bosh laser rangefinder, Bosch PLR 50C. The steps to reproduce and the symptoms are quite similar to yours. Just that it seems to happen when the browser tab isn't active, such as leaving the tab out of focus for a while or locking the computer. When the script tries to reconnect it wont make it past the reconnection stage. No error is thrown and the device selection dialogue won't open after that without a refresh.
One theory is that the macs bluetooth api won't answer the chrome tab if it isn't active and chrome is left hanging, but that's just a hunch at the moment. Debugging is a bit slow since I'm not on a mac myself and I have to bother someone else every time I have something to try.
There seems to be a bug in the web-bluetooth/automatic-reconnect example or in the way web bluetooth is implemented in Chrome. I have already filed a bug-report for Chrome, but since this may relate to API changes the bug may be caused by the fact that the sample code is out of date.
The problem: Bluetooth device connection promise not resolving if device times out.
Steps to reproduce the problem:
What is the expected behavior? The bluetoothDevice.gatt.connect() call should time out after some time if the client can not connect to the server. This does happen if the client disconnects but not the server (The BT device).
What went wrong? The bluetoothDevice.gatt.connect() Promise seems to never get resolved. This does only happen if the device times out. If the device is removed via bluetoothDevice.gatt.disconnect() the API behaves as expected.
Chrome version: 79.0.3945.130 Channel: stable OS Version: OS X 10.15.2