• I know some of you have had trouble with the instructions in the Quick Start so there's now another option.

    Web IDE Relay

    This allows you to use a phone or tablet (or any device that has Web Bluetooth) to access your Puck.js from a PC.

    Use as follows:

    • Open https://www.espruino.com/ide/relay on your phone. If you're using iOS you'll need to do this via the WebBLE web browser as Safari doesn't support Web Bluetooth.
    • Click the connect icon in the top left
    • Choose your Puck.js device
    • Now open https://www.espruino.com/ide on your PC
    • Copy the 8 digit 'relay key' that was displayed on your phone into Communications -> Relay Key in your Web IDE's settings on the PC
    • Now click the connect icon on the PC
    • Choose Web IDE Relay

    And enjoy programming Puck.js via your phone! Just make sure it doesn't go to sleep or you might lose your Bluetooth connection :)

    Hope that helps some of you out. It's still a bit 'beta', so if you have any suggestions/tweaks it'd be good to know.

  • youtube.com/watch?v=H8L8ft83­0hI

    It's also worth noting that the phone and PC don't have to be in the same place. You could be on the other side of the world programming Puck.js!

  • thanks @Gordon, nice work!

    I've tried with an ipad running /ide/relay and windows 10/Chrome for the web ide

    It took about 3 cycles to get it to work - however I did end up with a flashing red led!

    Then on ipad I get DISCONNECTED at the bottom.

    so you reconnect, and then need to enter the key again on the PC...

    Some feedback

    1. Please ask to update the bookmarks on WEBBLE to include espruino.com/ide/relay
    2. It doesn't look you can increase the font size on the relay key - I found it a bit hard to read
    3. There is no indication on the PC ide that the other end has disconnected? update - this did disconnect after sometime - quite a bit after the disconnect on the ipad
    4. Would it be possible to re-connect silently and retain the key so that it not needed to be re-entered?
      Perhaps the key could be picked up both ends from the url?
      espruino.com/ide/relay#rcm04­j5p
      espruino.com/ide#rcm04j5p
      Then it would not need to be typed into the settings?
      I realise there could be security implications here - just brain dumping
      5.
      if you don't update the key, and connect again on the PC - it says connected, but it isn't

    Device found (connectionId=undefined)
    [success] Connected to port Web IDE Relay
    >>> Connected to port Web IDE Relay
    

    So there seems to be no indication that the expired key or wrong key is used?

  • Odd about the repeated connects and disconnect - was the Puck nearby, or could it have had bad signal?

    I'll wait until it's a bit more stable before adding it to the bookmarks. It's trivial to add /relay to the end of the IDE URL and add it as a new bookmark though.

    It doesn't look you can increase the font size on the relay key - I found it a bit hard to read

    Hopefully I've just fixed that.

    There is no indication on the PC ide that the other end has disconnected?

    Good point - I thought it did, but looking at the code it doesn't.

    Would it be possible to re-connect silently and retain the key

    Reconnecting silently might be tricky with Web Bluetooth (as I guess it's entirely likely it would need user input?). The key should be retained - it is on Android I believe (it's stored in a cookie) but I wonder if WebBLE doesn't preserve cookies?

    So there seems to be no indication that the expired key or wrong key is used?

    Yes, I wasn't sure about that - I don't want people to be able to brute-force it to find other people's keys so for the moment I'm just leaving it with no response.

    If anyone does want to hack around on this, the code itself is here:

    relay: github.com/espruino/EspruinoWebI­DE/blob/gh-pages/relay/relay.js
    ide comms: github.com/espruino/EspruinoTool­s/blob/c57e60e94b6b324cbf1bd495f2365880a­805f2c3/core/serial_websocket.js

    It's not too difficult.

  • Having the key being able to be specified in the URL could work well - realistically it's only those on iOS that'd need it... Maybe at some point there could even be a QR code in the main IDE that generated a scannable link :)

  • Although i don't need it, this kind of efforts are always worth a donation. $5 sent.
    p.s. it's easy, just hit espruino.com/Donate .

    @Gordon Why not something like this below


    1 Attachment

    • donate.JPG
  • Thanks!

    :) that's a nice idea too! I don't have control of the forum itself at the moment, but stuff like that could be a good reason to start running the forum myself.

  • And some "like" emoticons, so I don't make too much noise with saying "great idea"

  • I was really interested in this option, tried it both combined with my LG G4 and the WebBLE app on my iPad, but was unable to get beyond the "connecting" dialog on my laptop.
    Don't really know where to look for debug info though.

  • The log on my laptop looks "normal", no errors, also no connection.


    1 Attachment

    • log_laptop.PNG
  • Log on my iPad, which also keeps on disconnecting while the puck is right beside it.


    1 Attachment

    • IMG_1084.PNG
  • I don't see any errors... Are you connecting on your laptop after connecting on the iPad - and are you absolutely sure the code you entered is the same on both devices?

    The IDE won't show you errors if the code is wrong - while it's annoying I decided not to report errors for incorrect codes to stop people brute-forcing every possible code to try and take control of other people's Pucks.

  • Hi Gordon,
    Can the Relay Key feature also be available on the Chrome extension and also the cli too?

  • Good question :)

    I'm not sure the chrome extension has been updated with it, but when I next do an update (or you manually install the version from GitHub) then yes, it'll work.

    With the command line tools I'm afraid it won't, because it's expecting to use the Web Browser's Websocket implementation which won't exist in Node.js. I guess with a bit of work it could do (especially if there's a Browser-compatible websocket implementation for Node.js?)

  • Not really, am using the latest version and it doesn't have the Relay feature.

    Am not sure if there is a module for that, maybe i check it out.

  • That's odd then. Out of interest - is there a reason you need to use the Chrome app? With the relay you shouldn't need it to access hardware directly

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

How to use Puck.js if your PC/Mac doesn't work with Web Bluetooth (Web IDE Relay)

Posted by Avatar for Gordon @Gordon

Actions