mqtt增加心跳间隔应对网络波动

This commit is contained in:
微微一笑
2025-08-09 15:02:40 +08:00
parent c0bb2bcd9c
commit d66b5aed7f

View File

@ -191,7 +191,8 @@ class MqttClient {
try { try {
const connectOptions = { const connectOptions = {
timeout: 4, timeout: 10, // 增加连接超时时间,应对网络波动
keepAliveInterval: 30, // 明确设置心跳间隔为30秒
userName: this.options.username, userName: this.options.username,
password: this.options.password, password: this.options.password,
useSSL: false, useSSL: false,