- timeA=millis();
- USE_SERIAL.println(timeA - timeB);
- strTotURL=strBaseUrl+strPage;
- strTotURL.replace(" ", "");
- //USE_SERIAL.println(strTotURL);
- http.begin(strTotURL, ca); //HTTPS
- http.addHeader("Content-Type", "application/x-www-form-urlencoded", false, true);
- httpCode = http.POST(strParams);
- if(httpCode > 0) // httpCode will be negative on error
- {
- if(httpCode == HTTP_CODE_OK) // file found at server
- {
- String payload = ">ADJ "+http.getString();
- USE_SERIAL.println(payload);//+payload
- timeA=millis();
- /*USE_SERIAL.print("time befor : " + timeB/1000);
- USE_SERIAL.print(" time after : " + timeA/1000);
- USE_SERIAL.println(" elapsed : " + ((timeA-timeB)/1000));*/
- USE_SERIAL.println(timeA - timeB);
- }
- else
- {
- String payload = http.getString();
- USE_SERIAL.println(String(">fail")+payload);
- }
- }
- else
- {
- USE_SERIAL.print(String(">")+httpCode);
- USE_SERIAL.println(">Acc ER1");
- }
- http.end();
POST to website
POST to website
hi , I am using the ESP 32 to send parameters VIA POST to website , I am using this code :
the problem is that the process is taking 2 sec give or take , is there any way that I can make it faster ?
Re: POST to website
Get a faster uplink and/or server
One problem is that HTTP negotiates a connection on each POST/GET etc.
So there is a lot of 'hello are you there', 'o yes I offer this', 'go on then here's my command' going on in each POST/GET.
Each interaction has potentionally a large latency.
MQTT and/or websockets would reduce latency significantly as these connection are established just the once rather on each transaction.
Grouping data will also improve performance. If you have 5 items to send then combine into one post.
I know - stamp coupling but the uplink won't bend to software 'rules'.
Unfortunately production quality software has to deal with potentially long response times.
The remote will not recieve data regularly and you will not always immediately recieve a 'i got it' response.
So you need to create a task which manages the uplink and allows your main task to get on with whatever.
One problem is that HTTP negotiates a connection on each POST/GET etc.
So there is a lot of 'hello are you there', 'o yes I offer this', 'go on then here's my command' going on in each POST/GET.
Each interaction has potentionally a large latency.
MQTT and/or websockets would reduce latency significantly as these connection are established just the once rather on each transaction.
Grouping data will also improve performance. If you have 5 items to send then combine into one post.
I know - stamp coupling but the uplink won't bend to software 'rules'.
Unfortunately production quality software has to deal with potentially long response times.
The remote will not recieve data regularly and you will not always immediately recieve a 'i got it' response.
So you need to create a task which manages the uplink and allows your main task to get on with whatever.
& I also believe that IDF CAN should be fixed.
Who is online
Users browsing this forum: No registered users and 121 guests