Skip to content

kekbait/web-bluetooth-polyfill

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

68 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Windows 10 Web Bluetooth Polyfill

The Polyfill enables Web Bluetooth in Chrome on Windows 10.

Build Status

Installation

  1. You need to have Windows 10 Creators Update (version 1703 / build 15063) or newer
  2. Clone this repo: git clone https://github.com/urish/web-bluetooth-polyfill
  3. Open Chrome Extensions pane (chrome://extensions/) and enable "Developer Mode" (there is a checkbox on top of the page)
  4. Click the "Load unpacked extension..." button
  5. Choose the extension folder inside the cloned repo
  6. Take a note of the extension ID for the newly added extension, you will need it in step 8. The ID is a long string of lowercase english letters, e.g. mfjncijdfecdpkfldkechgoadojddehp
  7. Download the latest BLEServer and unpack it inside C:\Program Files (x86)\Web Bluetooth Polyfill
  8. Edit C:\Program Files (x86)\Web Bluetooth Polyfill\manifest.json and change the extension id in the allowed_origins section to match the extension ID you found in step 6
  9. Run C:\Program Files (x86)\Web Bluetooth Polyfill\register.cmd to register the Native Messaging server

That's it! Enjoy Web Bluetooth on Windows :-)

Troubleshooting

  1. Run the winver program to verify that you have Windows 10 Creators Update. It should display: "Version 1703 (OS Build 15063.413)" or higher.
  2. Make sure "Experimental Web Platform Features" flag is disabled. You can set it using this link: chrome://flags/#enable-experimental-web-platform-features
  3. Open the Devtools console of any web page, and look for the message: "Windows 10 Web Bluetooth Polyfill loaded". If you don't see this message, it means that either the extension was not installed correctly, or you already have something setting the navigator.bluetooth object to some value.
  4. Follow the instructions here to debug the background page of the extension.

Current State

TL;DR - Should work out of the box with most Web Bluetooth apps.

Most of the functionality is already there, but there might be slight differences between the current implementation and the spec. Device Chooser UI is still missing, so the first matching device is picked up automatically. Check out the list of issues to see what is currently still missing. Pull Requests are very welcome!

List of API methods / events and their implementation status:

  • requestDevice
  • Device Chooser UI (#1)
  • gatt.connect
  • gatt.disconnect
  • gattserverdisconnected event
  • serviceadded / servicechanged / serviceremoved events (#3)
  • getPrimaryService / getPrimaryServices
  • getCharacteristic / getCharacteristics
  • writeValue
  • readValue
  • startNotifications / characteristicvaluechanged event
  • stopNotifications (#4)
  • getIncludedService / getIncludedServices (#5)
  • getDescriptor / getDescriptors (#6)

Running tests

If you want to run tests, during local development, you will need node.js and yarn. Then, run the following commands:

yarn
yarn test

You can also run the tests in watch mode, which will only run tests related to files changed since the last commit:

yarn run test:watch

About

Windows 10 Web Bluetooth Polyfill

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 74.5%
  • C++ 24.0%
  • C 1.3%
  • Batchfile 0.2%