• Hey! Maybe this should be a bug report on github, but I have found that I could not connect to my Bangle.js2 using WebRTC in the WebIDE. I then saw in the logs that there was some error message about failing to connect to some UUID (the name of an old connection). I then modified the local storage in the browser running the WebIDE to contain the new UUID (shown on the phone). Then the connection worked again. I guess clearing the local storage alltogether would have worked too.

    Anyway, I guess this is a bug of the WebIDE, that old saved webrtc bridge UUIDs in the local storage prevent the WebIDE from finding/connecting to new connections? Not entirely sure, but it surely made me scratch my head for a bit.

  • Maybe it is same thing but when I tried to share connection from gadgetbridge bangleapps browser and got some guid there was no way to enter it in IDE on the PC, it insisted on its own and I didn't find a way to change/forget it.

  • The UUID should be accessible from Settings -> Communications -> Remote Connection Bridge Peer ID - or was it something else?

    But I'm not sure I understand the issue? So you were using the remote connections option to connect via your phone, but then I guess maybe your phone lost the UUID so they couldn't connect?

    But then you should be able to click the Remote Connection button in the Web IDE's connection menu, scan the QR code and reconnect - or are you saying that doing that didn't work?

  • But then you should be able to click the Remote Connection button in the Web IDE's connection menu, scan the QR code and reconnect - or are you saying that doing that didn't work?

    I think this is the opposite flow and they collide but maybe I don't know how to use it.

    What I want is to connect PC WebIDE to already existing gadgetbridge connection between Bangle and Phone. I cannot connect directly so I found that via gadgetbridge apploader -> More.. ->"WebIDE remote" button -> "WebIDE remote access dialog" I can get long GUID that I can type on PC into Settings -> Communications -> Remote Connection Bridge Peer ID.

    But then what? I click connnect and there is only this small "🌐 Remote Connection" link on the bottom, but it is probably supposed to be used in the opposite way, because it has its own different guid and shows QR code. It does not use the guid I entered to "Settings -> Communications -> Remote Connection Bridge Peer ID"

    Should I somehow scan this QR code from gadgetbridge to connect it in the opposite way?

  • I can get long GUID that I can type on PC into Settings -> Communications -> Remote Connection Bridge Peer ID.

    Yes, if you're connecting through Gadgetbridge then that should be fine.

    You need to have the App Loader still open, and if you closed it you need to have clicked "WebIDE remote" again (it'll have the same ID).

    Then it should pop up in the IDE after you paste in the UUID and click connect and it should appear in the list - it's possible you may have to refresh the page with F5 to get it to pick up

  • which page should I refresh? the connection dialog only has web bluetooth/serial and emulator, remote connection link has different guid and qr code. When I click status link I see " Remote Connection Unknown Status". I still have gadgetbidge apploader running on the screen.


    1 Attachment

    • log.jpg
  • so maybe it simply does not work - chrome on windows 11. See console log image above - the Peer ID 7205b... is the guid it shows on qr code screen. f412.. .is my gadgetbridge guid from the phone. It is immediately closed with "no activity"

  • Oh and I also noticed blue "connected" message on the bottom of the bangle loader screen for a second when I refresh screen and open connection dialog on PC but it goes away in a second when Chrome console shows [WebRTC] No activity on connection - closing

  • @devsnd maybe I hijacked your topic but I am still not sure if it is same issue you have (or had) too. I checked my local storage and saw two keys : WEBRTC_CLIENT_PEER_ID and WEBRTC_BRIDGE_PEER_ID. None of them is same as the one from the phone I entered in settings. I have removed WEBRTC_BRIDGE_PEER_ID because it was different from both keys visible on both sides but there is no change, I still cannot connect. And the key did not come back again. I have also created it again and put the guid from phone there but it did not help too it behaves still the same - brief connecting/no activity mesage in chrome devtools console log but no way to connect from IDE UI. So I guess I have other issue.

  • which page should I refresh?

    The Web IDE. I just tried it here with Gadgetbridge and the Web IDE on Windows 11 and it works fine for me here.

    Are you 100% sure you copied the UUID correctly?

  • Are you 100% sure you copied the UUID correctly?

    Yes, I see blue connected message briefly in gadgetbridge apploader but then the IDE quickly logs "no activity" and "closing connection" as seen above. What kind of activity it expects?

  • The offending code is at https://github.com/espruino/EspruinoTools/blob/d809a2bacbe609edb189b82bcfb7782a4cd277c2/libs/webrtc-connection.js#L328

    There's a bit of documentation about what's meant to happen at the head of that file.

    ... but the [WebRTC] No activity on connection - closing 79543ed0-aa61-435f-ac9a-38ac3d01ac00 message is exactly what I get on mine when I have the wrong UUID or the App Loader relay isn't running on the phone I'm connected to.

    As I understand it with Peerjs you basically open a connection and it's a bit like going into a chatroom. The connection opens, but there may not be anyone there.

    The IDE connects using that UUID (the Phone is supposed to be the host) and it keeps sending ping messages once a second, but it it doesn't get any response in a second it times out.

    I guess it's possible that something about your connection means the messages take more that a second to arrive??

  • Also, just to add you can try the IDE relay out on the same PC. Click the Remote Connection text in one browser window, then copy the URL into another browser window. It'd be interesting to see if it works.

    ... or what happens if you scan the QR code with your phone (so not using Gadgetbridge but just chrome on your phone)

  • I guess it's possible that something about your connection means the messages take more that a second to arrive??

    That's probably it! I'm using LTE 5G data plan and don't typically use wi-fi when not at home. I just tried at home with wifi and it works. I turned off wifi on the phone and it stopped working from the same computer, now I have the same "No activity on connection" message over 5G.

    I tried to disable data saving quick toggle on the phone but it did not help.

    Maybe it is not just the speed as with wifi both devices are on the same network so they may even find direct path over local network avoiding NAT/firewalls, but still increasing the timeout might help since I get that blue/violet connected message on the phone.

  • Ok, cool. I've just gone from 2s -> 10s timeout so let's see if that helps

  • Thank you, but unfortunately it did not help. I see it is waiting much longer until the "[WebRTC] No activity on connection - closing ..." but still nothing.

    I get the blue "Connected to xxx..." message almost immediately on the phone when browser logs
    "[WebRTC] Peer ID: xxx ...." , "[WebRTC] Connecting to yyyy" but then nothing happens and after 10 seconds it ends in same way "[WebRTC] No activity on connection - closing yyyy"

    So I don't know, something is blocked somewhere when the phone is over mobile connection. The PC->phone direction is however somehow working as I get the connected message with correct guid of the PC side on the phone. Is there some logging of the phone javascript side where this WebRTC part runs?

  • Is there some logging of the phone javascript side where this WebRTC part runs?

    It should be about the same logging as in the IDE (IIRC it's the same code) so it's worth a try connecting by USB and using chrome://inspect-devices

    ... but you could try some other webrtc examples with your phone like https://peerjs.com/examples? If they fail there's not much I'll be able to do!

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

WebIDE: WebRTC bridge broken until local storage is modified/reset

Posted by Avatar for devsnd @devsnd

Actions