Just to add that there is something iffy going on with sockets getting into an invalid state, and that looks like a bug in the ESP8266 interface library for Espruino.
However, I think that's likely caused by trying to run the 3 sockets concurrently.
If you try this:
function getPrices() {
symbolCtr = symbolCtr+1;
if (symbolCtr>=symbols.length) symbolCtr=0;
let symbol = symbols[symbolCtr];
let url = `${proxy}${api}${symbol}-${currency}`;
console.log("Opening socket");
h.get(url, function(res) {
let pricesRaw = "";
res.on('data', function(d) { pricesRaw += d; });
res.on('close', () => {
console.log("Socket closed");
prices[symbol] = JSON.parse(pricesRaw);
showPrices();
});
});
}
every 10 seconds then I bet it'll be a lot more stable.
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.
Just to add that there is something iffy going on with sockets getting into an invalid state, and that looks like a bug in the ESP8266 interface library for Espruino.
However, I think that's likely caused by trying to run the 3 sockets concurrently.
If you try this:
every 10 seconds then I bet it'll be a lot more stable.