Web IDE: Error in connection establishment to websocket

Posted on
  • Hi,

    I'm using the Espruino Web IDE on Google Chrome Version 69.0.3497.100 (Official Build) (64-bit) with Ubuntu 18.04.1.
    I have tried enabling web Experimental Web Platform features, running bluetoothd in experimental mode, and I still get the same error:

    Handling URL "https://www.espruino.com/ide/"
    Couldn't connect to wss://localhost:31234 - disabling websockets for this session
    ERROR: getURL("/serial/ports") error : Not Found
    /serial/ports doesn't exist - disabling WebSocket support
    ERROR: serial_frame: getPorts timeout, disabling
    >>> Connecting...
    Set Slow Write = true
    

    EDIT - From the browser console:

    index.js:81181 WebSocket connection to 'wss://localhost:31234/' failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED
    ensureConnection @ index.js:81181
    index.js:78249 Couldn't connect to wss://localhost:31234 - disabling websockets for this session
    /serial/ports:1 Failed to load resource: the server responded with a status of 404 (Not Found)
    index.js:78259 getURL("/serial/ports") error : Not Found
    console.error @ index.js:78259
    index.js:78249 /serial/ports doesn't exist - disabling WebSocket support
    index.js:78259 serial_frame: getPorts timeout, disabling
    

    This isn't an issue with the browser's connection to the bluetooth adapter, as I can successfully find devices using the web-bluetooth testing page, so I know it's specifically a problem with the web IDE.

    I tried this on my Mac too, and the same problem occurred. Is the service down at the moment or ?

    I can provide screenshots upon request.

    Thanks in advance

  • Hi,

    Those errors aren't anything to worry about - the WebSocket connection is for https://github.com/espruino/EspruinoHost, which is a way to get Bluetooth LE and serial comms on non-Chrome web browsers. The connection failing isn't a problem - same with the /serial/ports bit. It's just trying to see what connection options are available.

    What happens when you click the connect icon in the top left then? Does it say 'No ports found'? It should say Web Bluetooth, which you then click on and get a port selector.

  • Hi Gordon,

    When I click the connect icon, it says "select a port", with the (only) option being "web bluetooth". When clicked, it then opens the modal saying "no compatible devices found" (see attached image).
    But when I use the testing page mentioned before, the same prompt shows many devices. I can provide a screenshot of that too if you need.

    Thanks for the quick response!


    1 Attachment

    • Screenshot from 2018-09-21 10-52-09.png
  • Ahh, ok - so Web Bluetooth itself does appear to be working with the IDE.

    What type of devices are you seeing in the Web Bluetooth example? Are any of them Espruino Bluetooth devices?

    The Web Bluetooth selector in the Web IDE shows only devices it thinks are actually running Espruino (so you don't get spammed with useless options when connecting). So if there are devices but none of them are running Espruino, that's what you'd expect to get.

  • We actually have a bunch of Espruino Bluetooth devices here - which is why it's a bit confusing. The IDE actually worked for someone else with a Mac yesterday, but I can't for the life of me get it working - after trying on two separate Ubuntu machines and a Mac. See the attached image for our Espruino Bluetooth devices (prefixed with SB) showing up on the Web Bluetooth Example (gonna call it WBE so I don't have to keep typing that out)


    1 Attachment

    • Screenshot from 2018-09-21 11-04-29.png
  • Ahh, ok. I won't say the company but I know what the product is.

    The code that's installed on those devices does a few things at boot, but two of them are:

    • It changes the name to SB;...
    • It removes the UART service, so they can't be reprogrammed with via the Web IDE

    It means the IDE isn't showing them because they don't have the correct name OR a UART service. Even if it did show them, the connection would fail.

    If you really want to connect with the IDE, you need to long-press the button while powering them on (for about 3-4 seconds). That'll boot without loading any of the saved code, and then you'll be able to connect.

    Careful you don't hold down for significantly longer than that though as then it'll clear out all the saved code from flash (so power cycling won't cause them to start up as normal) and you'll have to completely reprogram them with the JS.

  • Ah of course! I know the code, but for some reason it completely slipped my mind that disabling the UART service would have that effect (duh).
    Cheers Gordon.

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

Web IDE: Error in connection establishment to websocket

Posted by Avatar for user94249 @user94249

Actions