Ok, this is really weird but I'm able to reproduce this....
I'm porting code from using the PubSubClient library to this library. As you can imagine I had a few incompatibility issues. Nonetheless, I pressed on and but I was foxed with this one issue and couldn't figure out what I was doing wrong. So eventually, I use one of the Example sketches in order to provide a minimum reproducible case.
`// This example uses an Adafruit Huzzah ESP8266
// to connect to shiftr.io.
//
// You can check on your device after a successful
// connection here: https://shiftr.io/try.
//
// by Joël Gähwiler
// https://github.com/256dpi/arduino-mqtt
void connect(); // <- predefine connect() for setup()
void setup() {
Serial.begin(9600);
WiFi.begin(ssid, pass);
client.begin("iot.eclipse.org", 1883, net); // MQTT brokers usually use port 8883 for secure connections
I'm not using SSL, so I've changed the port to 1883
I'm using iot.eclispe.org as the MQTT broker
I'm using the connect method's overload that takes just the clientId parameter.
Now I have other cases (different code) where when I use a clientId of "NestEyeESP8266", I get the same soft WDT reset. However, if I change the clientId to "NestEyeESP826" or "NestEyeESP82A66" everything works as expected. I don't mind sharing this code privately if needed.
Ok, this is really weird but I'm able to reproduce this....
I'm porting code from using the PubSubClient library to this library. As you can imagine I had a few incompatibility issues. Nonetheless, I pressed on and but I was foxed with this one issue and couldn't figure out what I was doing wrong. So eventually, I use one of the Example sketches in order to provide a minimum reproducible case.
`// This example uses an Adafruit Huzzah ESP8266 // to connect to shiftr.io. // // You can check on your device after a successful // connection here: https://shiftr.io/try. // // by Joël Gähwiler // https://github.com/256dpi/arduino-mqtt
include
include
const char ssid = "ssis"; const char pass = "pass";
WiFiClientSecure net; MQTTClient client;
unsigned long lastMillis = 0;
void connect(); // <- predefine connect() for setup()
void setup() { Serial.begin(9600); WiFi.begin(ssid, pass); client.begin("iot.eclipse.org", 1883, net); // MQTT brokers usually use port 8883 for secure connections
connect(); }
void connect() { Serial.print("checking wifi..."); while (WiFi.status() != WL_CONNECTED) { Serial.print("."); delay(500); }
Serial.print("\nconnecting..."); while (!client.connect("arduino")) { Serial.print("."); }
Serial.println("\nconnected!");
client.subscribe("/example"); // client.unsubscribe("/example"); }
void loop() { client.loop(); delay(10); // <- fixes some issues with WiFi stability
if(!client.connected()) { connect(); }
// publish a message roughly every second. if(millis() - lastMillis > 1000) { lastMillis = millis(); client.publish("/hello", "world"); } }
void messageReceived(String topic, String payload, char * bytes, unsigned int length) { Serial.print("incoming: "); Serial.print(topic); Serial.print(" - "); Serial.print(payload); Serial.println(); }`
The changes I've made are:
Now I have other cases (different code) where when I use a clientId of "NestEyeESP8266", I get the same soft WDT reset. However, if I change the clientId to "NestEyeESP826" or "NestEyeESP82A66" everything works as expected. I don't mind sharing this code privately if needed.