Page 1 of 1

Best way to pass data to the html website [sockets/mqtt/http rest]

Posted: Mon Jun 17, 2019 10:59 pm
by KanyeKanye
Hi,
I have http server running on esp32 that sends html website to the pc.
I am wondering what is the best way to pass actual data from sensors to the website.
At the moment I use simple http rest (Each 5 seconds, using ajax, my javascript code, requests json file from esp32 and fill all website fields with actual values).
Honestly saying I know nothing about mqtt in details. Would it be somehow better? Suggest me some good, full of code example.

Re: Best way to pass data to the html website [sockets/mqtt/http rest]

Posted: Tue Jun 18, 2019 3:36 am
by ESP_Sprite
It depends, what's your use case? How's the setup going to be used in practice, what is it for?

Re: Best way to pass data to the html website [sockets/mqtt/http rest]

Posted: Tue Jun 18, 2019 8:14 am
by PaulNi
How do you want to do encryption, checksum and authentication?

If you can do authentication on transport layer (SSL/TLS/SSH) the final choice is kinda trivial.

HTTP/WS is not efficient for purposes of logging and etc, and has no native format on UDP.

So, I bet, mqtt + tls with auth + lightweight binary serialisation format will work for you.

You seem to be coming from a web dev background?

Re: Best way to pass data to the html website [sockets/mqtt/http rest]

Posted: Tue Jun 18, 2019 10:43 am
by KanyeKanye
I have no web dev background, but have a project to finish so I do learn new technologies
Esp monitors voltage, sends its value to browser. In borwser graph is showed.
What do you mean by encryption? There is no encryption, esp works as AP and provide HTTP server. No ssl or post-alike login.