Open Kenny2github opened 5 years ago
I found that
this._ws = new WebSocket('ws://'+window.location.hostname+':3000');
works nicely. This always returns the host for wherever the web page came from, so it's gets Dexters IP address if scratch was served from Dexter and it gets localhost if it's served from the PC
The problem is it gets your url if it's served from there. Still... better than a hard coded IP address. We probably need block that allows the user to set Dexters IP?
That works when you're running Scratch on your own, but the problem is that that doesn't work when you're using the built version on https://kenny2github.github.io/scratch-gui/ - there's no WS server running on ws://kenny2github.github.io:3000
Sorry, I wrote that before I found the compiled version we downloaded onto the robot. That's the version that should be changed, not this version. On this version, the block to change the IP address is the way to go.
Is there a way to raise issues on that version? https://github.com/Kenny2github/scratch-gui/tree/gh-pages The only outstanding problem is we can't load projects after we save them. I started trying to troubleshoot that today, but it's complex code and I'm quite lost.
Dexter now has a WS server running on its own, which means that the extension will need to get the IP to use and save it somehow.