mqtt增加心跳间隔应对网络波动
This commit is contained in:
@ -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,
|
||||||
|
Reference in New Issue
Block a user