urish / web-bluetooth-polyfill

Windows 10 Web Bluetooth Polyfill
76 stars 15 forks source link

The popup of selection of device don't discover any device #21

Closed jefBinomed closed 7 years ago

jefBinomed commented 7 years ago

I normally do all you need on your readme. But When I try to select a device via the popup, it don't show me anything :'(

The only I'm not sure to have done is to verify my version of windows. How can I know if I'm using the correct version ?

urish commented 7 years ago

Hi!

First of all, you can run winver to discover the Windows version.

Also, please inspect the extension's background page with Chrome Dev Tools (there's a link for that inside chrome://extensions) and check if you get any error message there

urish commented 7 years ago

image

jefBinomed commented 7 years ago

Yep, thank you, I check and keep you aware

jefBinomed commented 7 years ago

Hi Uri, sorry about the delay... So i try to inspect the background page and everything seems to work normally....

I see on the console, Connected to server.

For example, i try this page : https://beaufortfrancois.github.io/sandbox/web-bluetooth/eddystone-url-config/index.html wich works well on my other platform (linux, android)

I also check my version of windows and it works well to. Did i need to check something else ?

urish commented 7 years ago

That's a good start!

Next step: inspect the background page, then type there (in the console):

debugPrints=true;

Then, try connecting to the device though the web page, and you should see all the BLE advertisements and scan responses for the devices around you in the console of the background page. Check if you can spot your Eddystone beacon (or whatever device you have) there. Thanks!

conoro commented 7 years ago

I have the same problem - nothing appears in the scanning-for-devices pop-up. I've tried debugPrints=true; but it prints nothing to console for the background page.

In my case I'm trying to use the Espruino Puck.js web-app. The standalone Electron-based Espruino IDE works fine and shows me the Puck and I can connect, but the IDE running in Chrome shows an empty list. Ditto using jefBinomed 's page above. This is on latest version of Windows 10 1703 / 15063.296 and latest version of your polyfill. Anything else I can try to debug the issue? Thanks.

urish commented 7 years ago

Can you open the console window in the puck.js web app and see if you get any error message there?

conoro commented 7 years ago

I'm getting the following. Not sure how useful it is:

Handling URL "https://www.espruino.com/ide/"
/serial/ports Failed to load resource: the server responded with a status of 404 (Not Found)
VM45:1 GET https://www.espruino.com/serial/ports 404 (Not Found)
(anonymous) @ VM45:1
send @ jquery-1.11.0.js:9666
ajax @ jquery-1.11.0.js:9211
jQuery.(anonymous function) @ jquery-1.11.0.js:9357
(anonymous) @ utils.js:314
cb @ espruino.js:96
getGitHub @ getGitHub.js:33
cb @ espruino.js:94
callProcessor @ espruino.js:99
getURL @ utils.js:307
getJSONURL @ utils.js:361
getPorts @ serial_websocket.js:31
(anonymous) @ serial.js:52
getPorts @ serial.js:51
getPorts @ menuPortSelector.js:81
createPortSelector @ menuPortSelector.js:139
toggleConnection @ menuPortSelector.js:50
dispatch @ jquery-1.11.0.js:4624
elemData.handle @ jquery-1.11.0.js:4292
settingsConsole.js:40 getURL("/serial/ports") error : Not Found
console.error @ settingsConsole.js:40
(anonymous) @ utils.js:317
fire @ jquery-1.11.0.js:3099
fireWith @ jquery-1.11.0.js:3211
done @ jquery-1.11.0.js:9312
callback @ jquery-1.11.0.js:9720
settingsConsole.js:30 /serial/ports doesn't exist - disabling WebSocket support
settingsConsole.js:30 >>> Connecting...
settingsConsole.js:30 Set Slow Write = true
settingsConsole.js:30 BT> ERROR: NotFoundError: User cancelled the requestDevice() chooser.
settingsConsole.js:40 [notify_error] Connection Failed.
console.error @ settingsConsole.js:40
error @ notifications.js:46
(anonymous) @ menuPortSelector.js:169
(anonymous) @ serial.js:134
(anonymous) @ serial_web_bluetooth.js:141
settingsConsole.js:30 >>> Connection Failed.
jefBinomed commented 7 years ago

Ok Uri, I go deeper in your code and start to debug the extension and for me the problem comes to the fact that your in your polyfill.js you do this check if(!navigator.bluetooth) In my case, an object is return, it seems that the implementation is not working well (the native one)

And the second problem is that your polyfill seems to be load but it does not override the native methods. For exemple the request Device method is not call when I try to request a device... It's very strange.

I try to disable chrome://flags/#enable-experimental-web-platform-features and your polyfill works but it won't work for page that check if navigator.bluetooth is present at the begining of the page. So according to the order of scripts load, if could be better if you include in your content.js the code of you polyfill.js...

So to conclude, it works, but it will works even better if the content of polyfill.js is directly include in content.js ;)

No I have to try all the methods

regards

urish commented 7 years ago

Thanks @jefBinomed, good catch!

I added a troubleshooting section to our README with your findings.

Regarding the polyfill.js - did you actually try that? as far as I know, content.js does not have access to the javascript context of the page, so it can't really override the objects there.

@conoro Can you confirm whether chrome://flags/#enable-experimental-web-platform-features is disabled? From your console output it seems like the polyfill was not loaded, so it could be that this flag is enabled, thus preventing the polyfill from loading.

jefBinomed commented 7 years ago

@urish I think you are right about Context !!! So i will try to think to a work around. But by the way, for experimental stuffs, it's a good polyfill ;) thanks

To my point of view, the issue could be closed

conoro commented 7 years ago

@urish. Ah yes I had the experimental flag on, sorry.

I think that did the trick. I can now connect with the https://www.espruino.com/ide/ - Thanks!

But it took multiple page reloads and extension reloads before it worked. I got a variety of errors before that about ports not found and Web Bluetooth not being enabled. I'll see if I can spot a pattern.

But I'm finally able to use the Espruino IDE in Chrome which is awesome. Thank you.

urish commented 7 years ago

Awesome!

Seems like you both managed to get it working, so I am closing this issue.

If you figure out any way to improve the experience, pull-requests are welcome (or even a new issue with suggestions how to make things better)

titof49 commented 6 years ago

hi the stability is difficult to have for example with the thingy from nordic semi. do you know when it will present in the chrome Windows version?

urish commented 6 years ago

It did work very well for me with the thingy. Is there anything specific that doesn't work for you? Can you try from a different computer to eliminate the possibility of Windows drivers / hardware issues?

AFAIK, the Chrome team has started working on the Windows implementation. You can follow the up to date status here.

titof49 commented 6 years ago

Hi uri thank you for your response.

On the html5 app under android compared to windows, some values doesn't appear as environnement (temp humidity), I ll add screenshot.

Br, Christophe

Envoyé de mon téléphone Windows 10

De : Uri Shaked Envoyé le :jeudi 14 décembre 2017 01:43 À : urish/web-bluetooth-polyfill Cc : titof49; Comment Objet :Re: [urish/web-bluetooth-polyfill] The popup of selection of devicedon't discover any device (#21)

It did work very well for me with the thingy. Is there anything specific that doesn't work for you? Can you try from a different computer to eliminate the possibility of Windows drivers / hardware issues? AFAIK, the Chrome team has started working on the Windows implementation. You can follow the up to date status here. — You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.