Ok, an update on this... It's working great now, and I have just merged HTTPS client support in.
You can get an early build for the Espruino Pico and Wiznet/ESP8266/GSM modules by copying and pasting this into Advanced Flash in the Web IDE's settings:
And the code works just as before, just add https to the beginning of the URL:
digitalWrite(B9,1); // enable on Pico Shim V2
Serial2.setup(115200, { rx: A3, tx : A2 });
var wifi = require("ESP8266WiFi_0v25").connect(Serial2, function(err) {
if (err) throw err;
wifi.reset(function(err) {
if (err) throw err;
console.log("Connecting to WiFi");
wifi.connect("WiFi_name","WiFi_key", function(err) {
if (err) throw err;
console.log("Connected");
// Now you can do something, like an HTTP request
require("http").get("https://google.com", function(res) {
console.log("Response: ",res);
res.on('data', function(d) {
console.log("--->"+d);
});
});
});
});
});
However, bad news for those of you thinking of using this on other boards. The TLS spec seems to require that there be 16kB packet sizes, and it looks like you need two buffers. So you need over 32kB of free RAM minimum if you're going to abide by the spec. There's an extension to this where the client can ask for smaller buffers, but it's not guaranteed to work at all.
So it looks like running HTTPS on the ESP8266 is never going to happen (we have 12kB available for all code and variables currently). That'll have to wait for the new one EspressIF are releasing :)
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.
Ok, an update on this... It's working great now, and I have just merged HTTPS client support in.
You can get an early build for the Espruino Pico and Wiznet/ESP8266/GSM modules by copying and pasting this into
Advanced Flash
in the Web IDE's settings:And the code works just as before, just add
https
to the beginning of the URL:However, bad news for those of you thinking of using this on other boards. The TLS spec seems to require that there be 16kB packet sizes, and it looks like you need two buffers. So you need over 32kB of free RAM minimum if you're going to abide by the spec. There's an extension to this where the client can ask for smaller buffers, but it's not guaranteed to work at all.
So it looks like running HTTPS on the ESP8266 is never going to happen (we have 12kB available for all code and variables currently). That'll have to wait for the new one EspressIF are releasing :)