Electron slow http requests

Tags: #<Tag:0x00007fe2262ba358>


I am using HttpClient library and getting very slow request from test time server “http://worldtimeapi.org/api/ip” that takes less than 200ms from web browser.
This only hapens with electron, with photon over wifi there is everything ok.
I have good 3G signal with particle electron.

This is test code I am using…

#include "application.h"
#include "HttpClient.h"

* Declaring the variables.
unsigned int nextTime = 0;    // Next time to contact the server
HttpClient http;

// Headers currently need to be set at init, useful for API keys etc.
http_header_t headers[] = {
    //  { "Content-Type", "application/json" },
    //  { "Accept" , "application/json" },
    { "Accept" , "*/*"},
    { NULL, NULL } // NOTE: Always terminate headers will NULL

http_request_t request;
http_response_t response;

void setup() {

void loop() {
    if (nextTime > millis()) {

    Serial.println("Application>\tStart of Loop.");
    // Request path and body can be set at runtime or at setup.
    request.hostname = "worldtimeapi.org";
    request.port = 80;
    request.path = "/api/ip";

    // The library also supports sending a body with your request:
    //request.body = "{\"key\":\"value\"}";
    int timeStart=millis();

    // Get request
    http.get(request, response, headers);
    int totaltime= millis()-timeStart;
    Serial.print("Application>\tTime for request: ");
    Serial.print("Application>\tResponse status: ");

    Serial.print("Application>\tHTTP Response Body: ");

    nextTime = millis() + 10000;

I am getting response time from 5000-7500ms !!!??
If somene has reason/solution how to get faster response time please give me some advice.


I am using this lib

I logged time for request, and rx transaction…
Http Request time it takes about 5- 6sec !!?
Receiving TCP transaction is from 1-2 sec.

Faster HTTP request