ESP8266连接公共 MQTT 服务器报错

错误信息如下:

Connecting to WiFi…
Connecting to WiFi…
Connecting to WiFi…
Connecting to WiFi…
Connected to WiFi
Waiting for NTP time sync: .Time synchronized
Current time: Mon Aug 19 03:01:20 2024

Connecting to MQTT Broker as esp8266-client-A4:CF:12:B3:82:EE…
Failed to connect to MQTT broker, rc=-2
SSL error: Chain could not be linked to a trust anchor.
Connecting to MQTT Broker as esp8266-client-A4:CF:12:B3:82:EE…
Failed to connect to MQTT broker, rc=-2
SSL error: Chain could not be linked to a trust anchor.
Connecting to MQTT Broker as esp8266-client-A4:CF:12:B3:82:EE…
Failed to connect to MQTT broker, rc=-2

都是文档里的示例代码,改了个wifi地址和密码而已,就是连不上,想问问是什么原因?

服务器端可能用的自签的证书,不是CA证书。连接时应该有个是否进行CA验证, 可以设置不验证。