Skip to content

Commit bf9c339

Browse files
committed
comments
1 parent 46ae118 commit bf9c339

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

src/wifi/AdafruitIO_ESP8266.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ AdafruitIO_ESP8266::AdafruitIO_ESP8266(const char *user, const char *key,
2121
: AdafruitIO(user, key) {
2222
_ssid = ssid;
2323
_pass = pass;
24+
// Uncomment the following lines and remove the existing WiFiClient and MQTT
25+
// client constructors to use Secure MQTT with ESP8266.
26+
// _client = new WiFiClientSecure;
27+
// _client->setFingerprint(AIO_SSL_FINGERPRINT);
28+
// _mqtt = new Adafruit_MQTT_Client(_client, _host, _mqtt_port);
2429
_client = new WiFiClient;
2530
_mqtt = new Adafruit_MQTT_Client(_client, _host, 1883);
2631
_http = new HttpClient(*_client, _host, _http_port);

src/wifi/AdafruitIO_ESP8266.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,17 @@
2222
#include "Adafruit_MQTT_Client.h"
2323
#include "Arduino.h"
2424
#include "ESP8266WiFi.h"
25+
/* NOTE - Projects that require "Secure MQTT" (TLS/SSL) also require a new
26+
* SSL certificate every year. If adding Secure MQTT to your ESP8266 project is
27+
* important - please switch to using the modern ESP32 (and related models)
28+
* instead of the ESP8266 to avoid updating the SSL fingerprint every year.
29+
*
30+
* If you've read through this and still want to use "Secure MQTT" with your
31+
* ESP8266 project, we've left the "WiFiClientSecure" lines commented out. To
32+
* use them, uncomment the commented out lines within `AdafruitIO_ESP8266.h` and
33+
* `AdafruitIO_ESP8266.cpp` and recompile the library.
34+
*/
35+
// #include "WiFiClientSecure.h"
2536

2637
class AdafruitIO_ESP8266 : public AdafruitIO {
2738

@@ -40,6 +51,9 @@ class AdafruitIO_ESP8266 : public AdafruitIO {
4051
const char *_ssid;
4152
const char *_pass;
4253
WiFiClient *_client;
54+
// Uncomment the following line, and remove the line above, to use
55+
// secure MQTT with ESP8266.
56+
// WiFiClientSecure *_client;
4357
};
4458

4559
#endif // ESP8266

0 commit comments

Comments
 (0)