urish / web-bluetooth-polyfill

Windows 10 Web Bluetooth Polyfill
76 stars 15 forks source link

gatt.connect() does not cause a connection to be established #46

Closed ghost closed 6 years ago

ghost commented 6 years ago

Simply calling [some device].gatt.connect() does not cause a connection to be established. Is this per the Web Bluetooth specification?

If I test using Chrome on Android, I immediately get a connection. On Windows using the polyfill, I do not get a connection until I initiate service discovery. I've not had time to determine exactly which call triggers connecting but I'm doing things like connected_server.getPrimaryServices() after the then clause of my call to connect() executes.

urish commented 6 years ago

Yes, if I recall well this is how the Windows API is designed - it only establishes a connection when you actually interact with the device (enumerate the services, for instance). Last time I checked (about a year ago), I remember this was the case - you couldn't just ask the API to establish a connection without sending some request.

ghost commented 6 years ago

OK, thanks @urish

No comments on Microsoft's API design! :-)