[Snap!] connector problem

Issue #15 resolved
connochaetes created an issue

First of all: Nice work. Thank you.

I'm using a "BBC micro:bit" connected to a computer with a Debian stretch OS. I 've successfully tested ublocks-amd64.deb. Right now, I am checking out the "Snap!" version bromagosa-snap-ublocks-0c0ab210dfc4. Sadly, when I click the small "Rosa the rabbit" icon (located on the right side), all I get is: "Cannot reach microBlocks connector. Please make sure it is running."

I guess (hope), this might be a rookie mistake. Please, let me know, if you need further details. Any suggestions are welcome.

Comments (11)

  1. Bernat Romagosa

    The Snap! version is still very much under heavy development. Many things don't work well, and we are actually about to ditch the current connector to redo it from scratch.

    That said, if you want to play with it (understanding it's nowhere near ready for end users) you need to start the websockets to serial connector first. You can find it under the connector/node folder. You'll need to have NodeJS installed (v8+) and npm (v5+):

    cd connector/node
    ./start.sh
    

    After an automatic installation of some NodeJS modules, you should now see something like:

    µBlocks websockets-serial bridge started.
    Run me with --help for command line arguments
    Debug is disabled.
    

    You can now connect to your board from Snap!, but remember it's very experimental and it will change a lot before we actually release it. For now, we recommend sticking with the desktop version :)

    Thank you so much for your interest in the project, enjoy playing with it!

  2. connochaetes reporter

    Thank you for your help. I am aware, that the Snap! version of the MicroBlocks IDE is under development. I 'm just having fun, checking out new Snap! features.


    I tried the proceeding you proposed, but I am still facing problems: On my system, I got nodejs v8.11.3 and npm v5.6.0. When bromagosa-snap-ublocks-0c0ab210dfc4/snap.html isn 't started, I see:

    µBlocks websockets-serial bridge started.
    Run me with --help for command line arguments
    Debug is disabled.
    

    But after starting bromagosa-snap-ublocks-0c0ab210dfc4/snap.html, I get this error event:

    events.js:183
          throw er; // Unhandled 'error' event
          ^
    
    Error: This socket has been ended by the other party
    

    If it 's helpful, I can also send you the rest of the error message.

  3. Bernat Romagosa

    Hmm, is that error showing up in the connector side (node) or the client side (browser)?

    If it's the connector's, please run it with the -d flag, which stands for debug and will print further information:

    ./start.sh -d
    
  4. connochaetes reporter

    On the client side (browser), I just get the usual: Cannot reach [...] connector. [...]

    On the connector side (node), it 's the following output:

    connochaetes@locusta:~/Downloads/john_maloney-smallvm-2591190eb7bc/connector/node$ ./start.sh -d
    µBlocks websockets-serial bridge started.
    Run me with --help for command line arguments
    Debug is enabled.
    
    Waiting for websockets client to connect at port 9999.
    Placing system tray icon
    Websocket client connected
    events.js:183
          throw er; // Unhandled 'error' event
          ^
    
    Error: This socket has been ended by the other party
        at Socket.writeAfterFIN [as write] (net.js:364:12)
        at SysTray.writeLine (/home/connochaetes/Downloads/john_maloney-smallvm-2591190eb7bc/connector/node/node_modules/systray/lib/index.js:97:33)
        at SysTray.sendAction (/home/connochaetes/Downloads/john_maloney-smallvm-2591190eb7bc/connector/node/node_modules/systray/lib/index.js:115:14)
        at SysTray.systray.linked (/home/connochaetes/Downloads/john_maloney-smallvm-2591190eb7bc/connector/node/index.js:435:26)
        at WebSocketServer.<anonymous> (/home/connochaetes/Downloads/john_maloney-smallvm-2591190eb7bc/connector/node/index.js:119:21)
        at emitTwo (events.js:126:13)
        at WebSocketServer.emit (events.js:214:7)
        at handleUpgrade (/home/connochaetes/Downloads/john_maloney-smallvm-2591190eb7bc/connector/node/node_modules/ws/lib/WebSocketServer.js:87:16)
        at WebSocketServer.completeUpgrade (/home/connochaetes/Downloads/john_maloney-smallvm-2591190eb7bc/connector/node/node_modules/ws/lib/WebSocketServer.js:288:5)
        at WebSocketServer.handleUpgrade (/home/connochaetes/Downloads/john_maloney-smallvm-2591190eb7bc/connector/node/node_modules/ws/lib/WebSocketServer.js:227:10)
    
  5. Bernat Romagosa

    I see! It's a problem with the tray icon module. You can bypass the tray icon placement by passing it the -n flag:

    ./start -n -d
    

    This should fix it :)

  6. connochaetes reporter

    OK, the first problem is fixed. ./start.sh -n -d is working just fine. But, there 's still a problem on the client side (browser): In order to view the "Rosa the rabbit" icon, I have to do some clicks (e. g. change to flat design). That 's no problem. I just wanted to mention it. But then, the "Rosa the rabbit" icon remains grey. And it remains in the status: "Trying to reach microBlocks connector" I checked the websocket URL via the context menu, it 's: localhost:9999 Any suggestions? Am I right, that the microbit itself has not to be preconfigured?

  7. Bernat Romagosa

    Did you enable MicroBlocks in the client? To do so, you need to shift-click on the gear icon and select the last option: "enable µBlocks devices". Then you should see the Rosa button and the websockets connection loop should start.

  8. connochaetes reporter

    Thanks. That 's it: I didn 't shift-click on the gear icon. It 's mentioned on page 74 of the Snap! manual, but I didn 't think of it. This issue can be closed. It 's working just fine.


    Great job. This offers a bunch of possibilities. For it 's a work in progress, I guess, that you are thinking of the following issues. So, the next points are meant rhetorically:

    • It would be great, if it could be started out-of-the-box via browser without having to start: /connector/node/start.sh -n

    • The object interaction between the microbit device and other sprites (e. g. via the broadcast block) is quite fun. The fun would be even bigger, if there was an easy way to communicate intuitively with an untethered microbit device.

    Please, keep in mind, that I am just thankful for your work. I 'm just wondering, what could be. I 'll check out microblocks.fun from time to time to keep in touch with the project's status.

  9. Bernat Romagosa

    Cool, glad to know you got it working!

    We're wrecking our brains trying to find a solution that doesn't require a connector. It's not trivial at all though, as browsers don't expose serial ports to websites.

    We're also working on a WiFi interface to program boards remotely. It's kind of working, but slowly and unreliably, so it needs a lot more work.

    Thanks for your interest!

  10. Log in to comment