js-libp2p
                                
                                 js-libp2p copied to clipboard
                                
                                    js-libp2p copied to clipboard
                            
                            
                            
                        WebBluetooth
WebBluetooth now works in the Browser! *1, *2, *3
https://developers.google.com/web/updates/2018/10/nic70
*1 Only on Chrome *2 Only on Windows *3 It is a great start \o/
I think it works on macOS and Linux (tested chrome + linux a week ago and was working).
Implementing this will be tricky though. It requires the user to interact with the page (onClick event triggered or similar) before device selection can happen and the user has to explicitly select device. I think we could probably make it work anyway by providing some was of triggering bluetooth-discovery from the developers side though.
User Gesture Required
As a security feature, discovering Bluetooth devices with navigator.bluetooth.requestDevice must be triggered by a user gesture such as a touch or a mouse click. We're talking about listening to pointerup, click, and touchend events. – https://developers.google.com/web/updates/2015/07/interact-with-ble-devices-on-the-web#user_gesture_required
In the future UX could be much better: in WebExtension context the above requirement could be replaced by a "bluetooth" permission added to the manifest of IPFS Companion :trollface:
This is potentially huge: gives us alternative Local Discovery and Transport that do not depend on existence of any local network.
- design decisions: https://github.com/WebBluetoothCG/web-bluetooth/blob/master/rationale.md
- demos and code samples: https://googlechrome.github.io/samples/web-bluetooth/index.html
@lidel, did you have the opportunity to check libp2p/notes#6#issuecomment-458975204?
Any update on this?
In https://github.com/WebBluetoothCG/web-bluetooth/blob/main/rationale.md
The key/value structure of GATT is believed to reduce the risk of device exploits compared to the unstructured byte-stream of other protocols. When the Characteristic Aggregate Format and Characteristic Presentation Format Descriptors are provided for a Characteristic, the UA can further validate any data passed to the device
If one is to do a libp2p connection around this, one needs to write a wrapper around GATT so that it behaves like a byte stream anyway? I would be surprised to see good throughput coming from that. However, not all applications require huge throughput. Simple messaging would be great for this
@lidel, did you have the opportunity to check https://github.com/libp2p/notes/issues/6#issuecomment-458975204?
Web NFC seems much more suitable
I was really hoping to connect two phones directly to each other using Web Bluetooth, but, AFAIK, this is not actually possible with Web Bluetooth as one can only connect to 'GATT Servers', but not actually have the web app create such a GATT Server itself. So yes you can connect to a heartrate-monitor and read some interesting data, but it cannot be used to create a server on one device and then connect to it from another device.
Maybe if we explain our use case to Google they would consider adding support for creating a GATT server but I am not holding my breath.