Hi - those errors actually come from the puck.js library on the PC.
I think the easiest way to check for connection is to use Puck.isConnected(). I believe Puck.getConnection().on('close', function() { console.log("connection closed!") }); will work too - but to need to do that after you connected the first time
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 - those errors actually come from the
puck.js
library on the PC.I think the easiest way to check for connection is to use
Puck.isConnected()
. I believePuck.getConnection().on('close', function() { console.log("connection closed!") });
will work too - but to need to do that after you connected the first timeThe Puck library isn't that well documented externally, but there are a bunch of comments inside it that might help: https://github.com/espruino/EspruinoWebTools/blob/master/puck.js#L446