You are reading a single comment by @Gordon and its replies. Click here to read the full conversation.
  • 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.

About

Avatar for Gordon @Gordon started