Congratulatios for your course !
I’m writing from the south of the world…
Let me ask a question…please.
I want to use an ESP to sample an analog signal (200 times a second) an send it to a Server I have hosted in Amazon.
Can you please explain the basic use of GET or POST ?
Also, do you think is posible to to send information without loosing data while sending ? ( I mean during transmition can I sample ?)
Thanks in advance Best Regards. Hugo.
During the transmission, you cannot be reading new values with your ESP32. After a complete HTTP GET or POST request, you can keep reading more values…
But how many HTTP requests do you want to send to your Amazon server per second?
This page explains the difference between the HTTP methods POST vs GET.
In summary, an HTTP POST request sends the information that you want to send to your server in the body of the request.
POST /test/demo_form.php HTTP/1.1
An HTTP GET request sends the information in the URL (your values are directly inserted in the URL):
If you are just sending readings, you can choose any method. If you are sending sensitive data or readings, you should only use the POST method.
I hope that helps.
Thank you for your answer.
I tested Get function and works fine.
But I’m not shure if is the rigth option. I mean… Im trying to save on my Server DB readings of an analog input.
I want to sample my analog signal at least 200 times per second.
Now I’m sending data as eg. /233/432/433/456/…../432
four char for any sample that is 800 char per second and I can`t loose samples while I’m sending.
Do you think is posible with Get or Post ? Shoul I go to TCP socket conection ? (have you tested ?)
Do you suggest a way to compress such data ???
Thanks in advance, Regards. Hugo.
Hi Hugo, I think the GET function is a good option to send any type of data. How are you working with the values in the server db (with PHP?)?
but do you want to publish 200 readings per second to your server?
Hi Rui, Thanks for your answer.
Now I am sampling 120 times per second and sending to a Server on Amazon each 5 seconds aprox. I don`t use PHP. The Server has a program I developed usin Genexus who saves on a MySQL DB.
I want to be more eficient in the way I send the samples…. Thats the reason of my question.
so I think are 2 points to get better:
- To make a compression and send more infomation less frecuently.
- Use a diferent way to send information to the Server.
I don`t know how to improve this two points.
Any suggestion ???
Best Regards. Hugo,
I’ve never had any application that required sampling that many readings from a single device to a server, so I haven’t looked into any methods to optimize that project. I would probably send the data with and HTTP post encoded in a JSON object.