Have we lost WebIDE with TCP/IP? No, there is a workaroud #1097
Replies: 20 comments
-
Posted at 2023-08-29 by @gfwilliams I'm afraid it's gone because Google are in the process of shutting down the Chrome web app, so we're left with I guess the only real option would be to make the Linux build capable of starting an HTTP server with websockets - there is a fragment of JS code that does this already (below), but because it's doing it in JS isn't not as flexible as something built in at a lower level: function onPageRequest(req, res) {
res.writeHead(200, {'Content-Type': 'text/html'});
res.end(`<html>
<body style="margin:0px">
<iframe id="ideframe" src="https://www.espruino.com/ide/" style="width:100%;height:100%;border:0px;"></iframe>
<script src="https://www.espruino.com/ide/embed.js"></script>
<script>
var ws = new WebSocket("ws://" + location.host + "/ws", "serial");
var Espruino = EspruinoIDE(document.getElementById('ideframe'));
Espruino.onports = function() {
return [{path:'local', description:'Local Device', type : "net"}];
};
Espruino.onready = function(data) { Espruino.connect("local");};
Espruino.onwrite = function(data) { ws.send(data); }
ws.onmessage = function (event) { Espruino.received(event.data); };
ws.onclose = function (event) { Espruino.disconnect(); };
</script>
</body>
</html>`);
}
/* Hack to ensure that `reset` won't cause us problems */
global.reset = function() {
console.log("Ignoring reset() request");
};
var server = require('ws').createServer(onPageRequest);
server.listen(80);
server.on("websocket", function(ws) {
ws.on('message',function(msg) { LoopbackA.write(msg); });
LoopbackA.on('data',function(msg) { ws.send(msg); });
ws.on('close', function() {
LoopbackA.removeAllListeners();
USB.setConsole();
});
LoopbackB.setConsole();
}); |
Beta Was this translation helpful? Give feedback.
-
Posted at 2025-01-18 by @MaBecker Nice, thanks for posting this. Started with including ws.min.js into the LINUX build, changed to port to 8080, added
and in terminal this
which is line 31. - any hints? |
Beta Was this translation helpful? Give feedback.
-
Posted at 2025-01-19 by @MaBecker
looks like Direct Sockets API can be a solution when release into stable version, here is the telnet client demo. Only works if the chrome browser version has TCPSocket. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2025-01-19 by @enaon
I am testing espruino on esp32 and run into the same problem, I guess you know it but the native web ide (Web IDE version 0.75.8) still has tcp support. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2025-01-19 by @MaBecker Yes, good point, but I am on Mac os X. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2025-01-20 by @gfwilliams I believe if you have the Espruino CLI tools (
And then you can just connect to But that Direct Sockets API is a good find - although it appears to be only for 'Isolated Web Apps' - so adding it to the IDE isn't going to be as simple as just adding a file. We're going to have to figure out how to make it an IWA - although honestly I'm less excited about that, having already changed the IDE to run under NW.js, Electron, Chrome Web Apps and Progressive web apps :( |
Beta Was this translation helpful? Give feedback.
-
Posted at 2025-01-22 by @MaBecker Wow - that is great - many thanks for implementing and sharing this! |
Beta Was this translation helpful? Give feedback.
-
Posted at 2025-01-23 by @MaBecker Hmm, file open and save does not work for me, do I miss some Chrome security setting?
and
|
Beta Was this translation helpful? Give feedback.
-
Posted at 2025-01-23 by @gfwilliams Huh, that's interesting! I've never hit that before. I imagine you can still open and close files using the 'old' method (just not the new showSaveFilePicker). I just don't know how we can detect when we're allowed to call showSaveFilePicker or not. I guess it may be possible with https://stackoverflow.com/questions/2365822/detect-when-iframe-is-cross-domain-then-bust-out-of-it |
Beta Was this translation helpful? Give feedback.
-
Posted at 2025-01-23 by @MaBecker
Sorry - l have no idea what you mean and how to fix it. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2025-01-24 by @gfwilliams fixed. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2025-01-24 by @MaBecker Many thanks! |
Beta Was this translation helpful? Give feedback.
-
Posted at 2025-01-25 by @MaBecker Checking again:
@gordon Can you please take another look into this? |
Beta Was this translation helpful? Give feedback.
-
Posted at 2025-01-27 by @gfwilliams
Yes - that's because in the iframe we can't get at those features (because of the above error) so literally all you can do is open files.
I don't quite understand what you mean here? |
Beta Was this translation helpful? Give feedback.
-
Posted at 2025-01-27 by @MaBecker Maybe a picture helpsAttachments: |
Beta Was this translation helpful? Give feedback.
-
Posted at 2025-01-28 by @gfwilliams but when you click 'Save File' on the localhost version, you still get a dialog to save the file? Just as a download. Or is that broken? |
Beta Was this translation helpful? Give feedback.
-
Posted at 2025-01-28 by @MaBecker No dialog, just download. Edit: add screen shots click on "Save File"
|
Beta Was this translation helpful? Give feedback.
-
Posted at 2025-01-28 by @fanoush That is related to setting both in Chrome and Firefox - ask where to download files? By default it is turned off. Just checked and in Chrome it is in Settings -> Downloads -> Ask where to save each file before downloading |
Beta Was this translation helpful? Give feedback.
-
Posted at 2025-01-29 by @gfwilliams Thanks @fanoush! Explains why it worked for me I guess. I don't think there's anything further than can be done with the IDE when running this way - it's all the web browser will let us do |
Beta Was this translation helpful? Give feedback.
-
Posted at 2025-01-30 by @MaBecker thanks |
Beta Was this translation helpful? Give feedback.
-
Posted at 2023-08-26 by @MaBecker
I often used the LINUX board and connect via WebIDE and TCP/IP for source testing. Looks like this is not possible any more because
SETTINGS->COMMUNICATION
does not offer TCP/IP input. I still can build a LINUX board and launch it with parameter --telnet like this:Any hints what I miss or what workaround is available to get this working again?
Beta Was this translation helpful? Give feedback.
All reactions