Available in Chrome 58+ | View on GitHub | Browse Original Sambles by Chrome
The Web Bluetooth API lets websites discover and communicate with devices over the Bluetooth 4 wireless standard using the Generic Attribute Profile (GATT). It is currently partially implemented in Android M, Chrome OS, Mac, and Windows 10.
This is an example of writing and reading files over BLE. Be warned, the speed is roughly 5mb / minute! (Yes Minute!) This is because we are using the GATT protocol which is not designed for high speed transfers and we are limited to 512 bytes per write. Currently we do not expect a conformation for each write (writeValueWithoutResponse), which likely increases speed but might lead to package loss (I have not experienced this though). We also read the whole file into the process memory on both sides (Client and Server). Hence beware of large files. Best ist to create ZIPs and split them into junks before sending.
This sample requires a Bluetooth device that supports the following service and characteristics:
caec2ebc-e1d9-11e6-bf01-fe55135034f0
caec2ebc-e1d9-11e6-bf01-fe55135034f1
caec2ebc-e1d9-11e6-bf01-fe55135034f2
caec2ebc-e1d9-11e6-bf01-fe55135034f3
Will automatically send the file once selected.
Will automatically receive the file once clicked.