nwjs/nw.js

[BUG] Bluetooth device chooser doesn't work since 0.75

Scavanger opened this issue · 0 comments

Issue Type

Since V 0.75 the Bluetooth functionality seems to be broken.

The small example app below works perfectly until nw.js 0.74, from 0.75 onwards instead of the bluetooth device chooser of Chrome the error message appears: "Error: NotFoundError: User cancelled the requestDevice() chooser."

Expected/Proposed Behavior

Bluetooth device chooser shows up

Additional Info

  • Operating System: WIN 11

  • NW.js Version: since 0.75

  • Code snippet:

package.json:

{
  "name": "BLE Test",
  "description": "BLE Test",
  "version": "0.0.1",
  "main": "main.html",
  
  "scripts": {
    "start": "node node_modules/nw/bin/nw .",
    "nw": "nw"
  },
  
  "dependencies": {
    "nw": "^0.75.0"
  }
}

main.html:

<!DOCTYPE html>
<html>
<head>
<script>
function bleTest() {
  navigator.bluetooth.requestDevice({
  filters: [{ services: ['generic_attribute'] }],
        })
  .then(device => {
    alert('> Name: ' + device.name + '\nID: ' + device.id + '\n: ' + device.gatt.connected);
  })
  .catch(error => {
    alert('Error: ' + error);
  });
}
</script>
</head>
<body>
<h2>nw.js BLE Test</h2>

<p id="demo">BLE Test</p>
<button type="button" onclick="bleTest()">Test it</button>

</body>

</html>