What if I told you websites could communicate with nearby Bluetooth devices in a secure and privacy-preserving way? This way, heart rate monitors, singing lightbulbs, and even  turtles could interact directly with a website.

Until now, the ability to interact with Bluetooth devices has been possible only for platform-specific apps. The Web Bluetooth API aims to change this and brings it to web browsers as well.

Before we start

This article assumes you have some basic knowledge of how Bluetooth Low Energy (BLE) and the  Generic Attribute Profile (GATT) work.

Even though the  Web Bluetooth API specification is not finalized yet, the spec authors are actively looking for enthusiastic developers to try out this API and give  feedback on the spec and  feedback on the implementation.

A subset of the Web Bluetooth API is available in Chrome OS, Chrome for Android 6.0, Mac (Chrome 56) and Windows 10 (Chrome 70). This means you should be able to  request and  connect to nearby Bluetooth Low Energy devices,  read/write Bluetooth characteristics,  receive GATT Notifications, know when a  Bluetooth device gets disconnected, and even  read and write to Bluetooth descriptors. See MDN’s  Browser compatibility table for more information.

For Linux and earlier versions of Windows, enable the #experimental-web-platform-features flag in chrome://flags

#javascript #programming

Communicating with Bluetooth devices over JavaScript
37.55 GEEK