Yes yes yes!
I want to build custom RemoteSensor Panel using HTML.
Javascript EventSource request can be blocked by browser, in order to Same Origin Policy.
To make it work JS must have extra parameter:
withCredentials: true
So, if IP of target machine is 192.168.1.2
JS would look like this:
var source = new EventSource("http://192.168.1.2/sse", {
withCredentials: true });
Server (AIDA64 on target machine) should answer with extra headers:
Access-Control-Allow-Origin: *
Access-Control-Allow-Credentials: true
Access-Control-Expose-Headers: * - it's just to be sure)
But it would be realy great if you make one more API.
API would answer with JSONP
like:
myCallback({
sensor1: {
label: "CPU1",
value: 37,
unit: "°С"
},
sensor2:{
label: "CPU2",
value: 38,
unit: "°С"
},
sensor3:{
label: "Memory usage",
value: 40,
unit: "%",
color: "#00FF00"
}
});
http://stackoverflow.com/questions/2067472/what-is-jsonp-all-about
And would be perfect if you could get only needed sensor items you want, if you send extra GET param.
like:
http: //192.168.1.2/api?sensors=sensor1&callback=myCallback
Answer would be:
myCallback({
sensor1: {
label: "CPU1",
value: 37,
unit: "°С"
}
});