I got my Puck.JS today and wanted to get right into programming without waiting for my bluetooth dongle to arrive. So I tried to use the relay function.
Unfortunately I could not get it to work though. It always stopped with the message "Starting Websocket connection" on the phone. I tried it with my Nexus 5X on Android 7.1.1 and Chrome 57.0.2987.132.
I then tried to start up the server on my own computer to potentially see what went wrong node server.js did not server anything under /relay and I also read that it only supports one session at a time, which would probably cause problems with the relaying anyways.
With the python server twisted I managed to server the root directory with ssl including the /relay subdirectory using twistd -no web --https=4444 --path=.. But I could not figure out if there is a websocket relay server included or if there is a default one that I should be running.
I also tried setting var WS_HOST = 'wss://espruino.com:8443'; with the UI hosted from my computer. With that and the following code added to relay.js, I got the output Encountered an error: {"isTrusted": true}. Which didn't yield any additional insights and might just be due to Cross-Origin restrictions.
socket.addEventListener('error', function (error) {
term("Encountered an error: "+JSON.stringify(error));
});
Any pointers on how to properly run a local setup or maybe get the relay on espruino.com working are much appreciated.
On a related note: @Gordon Did you try or think about using peer-to-peer communication using WebRTC instead of websockets for the communication between the browsers? That way there might not be a need for a websocket server.
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Hi,
I got my Puck.JS today and wanted to get right into programming without waiting for my bluetooth dongle to arrive. So I tried to use the relay function.
Unfortunately I could not get it to work though. It always stopped with the message "Starting Websocket connection" on the phone. I tried it with my Nexus 5X on Android 7.1.1 and Chrome 57.0.2987.132.
I then tried to start up the server on my own computer to potentially see what went wrong
node server.js
did not server anything under/relay
and I also read that it only supports one session at a time, which would probably cause problems with the relaying anyways.With the python server twisted I managed to server the root directory with ssl including the
/relay
subdirectory usingtwistd -no web --https=4444 --path=.
. But I could not figure out if there is a websocket relay server included or if there is a default one that I should be running.I also tried setting
var WS_HOST = 'wss://espruino.com:8443';
with the UI hosted from my computer. With that and the following code added torelay.js
, I got the outputEncountered an error: {"isTrusted": true}
. Which didn't yield any additional insights and might just be due to Cross-Origin restrictions.Any pointers on how to properly run a local setup or maybe get the relay on espruino.com working are much appreciated.
On a related note: @Gordon Did you try or think about using peer-to-peer communication using WebRTC instead of websockets for the communication between the browsers? That way there might not be a need for a websocket server.