-
While developing, my website will reload upon code changes, which requires me to reselect my already paired Puck.js which is cumbersome.
I noticed that the WebIDE is capable of connecting to an already paired device without showing the navigator.bluetooth dialogThe WebIDE at https://www.espruino.com/ide/ can keep previous connection info and reconnect, however it is also lost when you reload the page. I think this is by design and is some sort of security so devices are not silently accessed across different pages.
I use https://www.puck-js.com/puck.js and
to connect to Puck.js (v2.09) from my website. While developing, my website will reload upon code changes, which requires me to reselect my already paired Puck.js which is cumbersome.
I noticed that the WebIDE is capable of connecting to an already paired device without showing the navigator.bluetooth dialog, however it relies on EspruinoTools which I couldn't get to integrate nicely with my webpage.
will provide currently paired devices, however forwarding such a device to the
connect()
method replacing the call tonavigator.bluetooth.requestDevice
was not successful, resulting in a "Bluetooth device is out of range error". I suspect this happens because the last advertisement packet is too old, so I waited onprepairedDevice.watchAdvertisements()
to fire first which took care of the "out of range error" but somehow introduced emptytxItem.data
items inpuck.writeProgress(txItem.maxLength - txItem.data.length, txItem.maxLength);
Is there a solution that avoids "re-pairing" my Puck.js on every page load, i.e. by adapting the puck.js file or somehow integrating parts of the WebIDE/EspruinoTools?
Thanks a lot for your help!