Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTTP Client fails when instantiated locally rather than globally #156

Open
tigoe opened this issue Jul 13, 2023 · 0 comments
Open

HTTP Client fails when instantiated locally rather than globally #156

tigoe opened this issue Jul 13, 2023 · 0 comments
Assignees
Labels
topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project

Comments

@tigoe
Copy link

tigoe commented Jul 13, 2023

When you put the instantiation of the ArduinoHttpClient in the loop or in any function, the client often fails to finish the request. It will make the HTTP call, and the server will acknowledge it, but then nothing happens until timeout.

Tested on Nano RP2040 (for WiFiNINA) and Uno R4 WiFi.

It fails for both HTTP and HTTPS, using the steps below:

To reproduce this, using Examples -> SimpleGet:

  1. change line 12 to #include the correct library for your board (WiFiNINA.h, WiFiS3.h, etc)
  2. change serverAddress (line 21) to "www.arduino.cc" or any test server
  3. change port (line 22) to 80
  4. Enter SECRET_SSID and SECRET_PASS in arduino_secrets.h for your network
  5. Move line 25, HttpClient client = etc. to the first line of the loop() function (line 49)
  6. Upload and watch the results. It will fail at line 50, "Making GET request". It will succeed about 25% of the time, but it will fail in a significant number of cases.

To test HTTPS, change WiFiClient instantiation on line 24 to WiFiSSLClient, and change port to 443.

@per1234 per1234 added type: imperfection Perceived defect in any part of project topic: code Related to content of the project itself labels Jul 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project
Projects
None yet
Development

No branches or pull requests

3 participants