Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Intrawbe and IOT
#1
Hello,
I have a little question :
I developed an application with Intraweb+boostrap which works perfectly, now I have to add the taking into account of "device" of the IOT type
These are sensors controlled by a microcontroller (ESP32) which communicate through wifi.
Each microcontroller is considered as a “node”, this “node” sends at regular intervals a “Json packet” which contains the values of the different sensors, in the form:
    String address = String("http://") + String(host) + String("/vsc/data/mc");
    http. begin(customer, address);
    http.addHeader("Content-Type", "application/json");
    int httpCode = http.POST(postData);

What I am trying to do is retrieve this frame in order to be able to store it and update the display of the current web page which contains the widgets corresponding to the values contained in this frame.
For the update of the page, I use a script which is in the html of the page, for example
  source.addEventListener('new_readings', function(e) {
    console.log("new_readings", e.data);
    var obj = JSON.parse(e.data);
    document.getElementById("mvolts").innerHTML = obj.mvolts;
    document.getElementById("lvolts").innerHTML = obj.lvolts;
    document.getElementById("afr").innerHTML = obj.afr;
  }, false);

I don't know what is the solution to use for the reception of this frame, create a "Contenthandler" as in the example "dyncontenthandler"? Or use another solution?
Thank you for your time
Alain
Reply
#2
I ended up finding it on my own
Smile
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)