Skip to content

[web-bluetooth] Bluetooth device connection promise not resolving if device times out #668

@olivierklaver

Description

@olivierklaver

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:

  1. Launch Chrome
  2. Go to: https://googlechrome.github.io/samples/web-bluetooth/automatic-reconnect.html
  3. Click Scan button
  4. Select BTLE device
    (Tested with Wahoo Cadence Sensor and Wahoo Heart Rate Sensor)
  5. Wait for the device to connect
  6. Let the sensor rest until it disconnects
  7. Wait for the 'gattserverdisconnected' event to be triggered and the first reconnect cycle to start
  8. The program will stall and the requestDevice() chooser will stop responding

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions