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

KanyeKanye
Posts: 54
Joined: Mon Dec 05, 2016 12:34 am

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

Postby KanyeKanye » Mon Jun 17, 2019 10:59 pm

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.

ESP_Sprite
Posts: 9730
Joined: Thu Nov 26, 2015 4:08 am

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

Postby ESP_Sprite » Tue Jun 18, 2019 3:36 am

It depends, what's your use case? How's the setup going to be used in practice, what is it for?

PaulNi
Posts: 41
Joined: Tue Nov 07, 2017 3:50 pm

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

Postby PaulNi » Tue Jun 18, 2019 8:14 am

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?

KanyeKanye
Posts: 54
Joined: Mon Dec 05, 2016 12:34 am

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

Postby KanyeKanye » Tue Jun 18, 2019 10:43 am

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.

Who is online

Users browsing this forum: No registered users and 125 guests