42wim / plugctl

Smartplug Maginon controller
GNU General Public License v2.0
5 stars 4 forks source link

"/stream" is using a cached version of "/read.json" when getting new data #1

Closed joyrider3774 closed 9 years ago

joyrider3774 commented 9 years ago

Hi,

As i mentioned before "/stream" is not working with me. I looked into the problem myselve and the problem is that the javascript keeps getting a cached version of "/read.json" resulting in never changing data. I have this problem on internet explorer 11 but not in Firefox.

internet explorer screenshot: knipsel

Firefox screenshot taken in same timeframe as internet explorer knipsel2

The fix is rather simple. just add an ever changing value as a parameter for getting the json value like so: window.intervalId = setInterval(function () { dat=new Date(); $.getJSON('/read.json?t=' + dat.toString() , function(data) { d.push([new Date(),data[1],data[2],data[3],data[4]]) g.updateOptions( { 'file': d } ); }); }, 1000);

and it works in internet explorer as well

/history sometimes has the same problem as well, i couldn't get the data for the last hour, i suspect, but haven't looked into this that it's the same problem. Internet explorer is getting the data from it's cache