Looking for an example with http: and or https: requests (WiFiClient, WiFiClientSecure)



I would like to try to port my GxEPD2 example GxEPD2_WiFi_Example.ino (Arduino) to the Particle environment.

The example uses WiFiClient and WiFiClientSecure to send a request to a web server to retrieve bitmaps and display them on e-paper. The bitmaps are received as a stream of data. It runs on ESP8266 or ESP32, compiled with Arduino IDE.

I ask this question in a new topic, as I have about no experience in searching in the Particle Forum and environment. Please help me to help my users of my library for Particle.


GxEPD2_PP : Particle Display Library for SPI E-Paper Displays

You can have a look at the TCPClient object or the higher level HTTPClient library (uses TCPClient).
Unlike the Arduino side TCPClient is agnostic to whether you are using WiFi, Cellular or Ethernet.

Secure is a bit more involved and due to the limited space restricting the max size of your main project considerably.

BTW, if you have some source code showing or linking to it would be clever :wink:
Don’t expect the members here to rummage the web in order to find the sources they’d need to help but have no personal interest in (yet).


Thank you. Maybe I should add a more general question: how do I find examples for libraries or built-in functions. In the Arduino IDE I have Examples in the main menu, showing both general examples and examples of packages loaded (by Board Manager) and libraries loaded (by Library Manager). And as ESP32 and ESP8266 have WiFi, I find the examples for WiFi there.

I know I should look through documentation and tutorials, but I hoped for a quick link.

My example is here:


Libraries usually come with their own examples.
For “fundamentals” (like TCPClient) there are usually minimal examples in the docs.

That would make you a copy/paster, but the real fun is understanding the priciples first and then analyse any pre-fab code on basis of that insight :wink:

However, this is where you’d find the doc’s TCPClient example

A quick browse through the code you linked suggests that TCPCient may just be used as drop in replacement for WiFiClient.
Give that a try and see what may still fail - minor tweaks may still be needed.


I am a copy/paster, and I learn a lot when adapting copied code. Thanks for the link.

I have no problem spending a lot of time searching for my own projects, preferably in my favorite environment, but when I try to help other users I show a lack of patience, and frustrate them when saying “I have no time for this”.

Yes, TCPClient is what I need for a start. Unfortunately most of the nice bitmaps are on GitHub and need https: to get retrieved. But I could do a http: only example.


Version 1.1.0+

  • added GxEPD2_PP_WiFi_Example, for bitmap download from web
  • only download from http: works, would need help for https:
  • only on GitHub, to avoid the need to increase the version for publish
  • this is preliminary!

@ScruffR, thank you for your help, TCPClient works for http:, didn’t need to change anything else.


I don’t get a clear picture if I search for support for https: requests. Some libraries are mentioned, but none is really recommended? Webhooks are recommended, but this is not what I am looking for. On Arduino I had issues with WiFiClientSecure on ESP8266 using axTLS, but BearSSL::WiFiClientSecure seems to work fine. Nothing similar for Particle/Photon?

And of course I always look for a simple example to start with.