mm_os 3.0.3 → 3.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/core/com/app/drive.js
CHANGED
package/core/com/mqtt/index.js
CHANGED
|
@@ -43,11 +43,10 @@ class MQTT extends Index {
|
|
|
43
43
|
online_expires: 150000,
|
|
44
44
|
// 在线有效期检测间隔
|
|
45
45
|
online_interval: 10000,
|
|
46
|
-
// 连接超时
|
|
47
|
-
connectTimeout:
|
|
46
|
+
// 连接超时
|
|
47
|
+
connectTimeout: 30000,
|
|
48
48
|
// maxInflight: 20,
|
|
49
49
|
// 重连间隔
|
|
50
|
-
// interval: 6000,
|
|
51
50
|
reconnectPeriod: 6000 // 重连间隔1秒
|
|
52
51
|
}
|
|
53
52
|
// 定时器
|
package/core/com/mqtt/mm_mqtt.js
CHANGED
|
@@ -24,8 +24,10 @@ class MM_mqtt {
|
|
|
24
24
|
topic_receive: "client/message/",
|
|
25
25
|
longtime: 15000,
|
|
26
26
|
// maxInflight: 20,
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
// 重连间隔时间,单位为毫秒, 默认6秒
|
|
28
|
+
reconnectPeriod: 6000,
|
|
29
|
+
// 连接超时时间,单位为毫秒, 默认30秒, 即尝试连接5次
|
|
30
|
+
connectTimeout: 30000
|
|
29
31
|
}, config);
|
|
30
32
|
|
|
31
33
|
// mqtt客户端服务器
|
|
@@ -79,8 +81,9 @@ MM_mqtt.prototype.reconnect = function() {
|
|
|
79
81
|
if (this.retryTimes > 5) {
|
|
80
82
|
try {
|
|
81
83
|
this.client.end();
|
|
82
|
-
|
|
83
|
-
|
|
84
|
+
setTimeout(() => {
|
|
85
|
+
this.init();
|
|
86
|
+
}, this.config.reconnectPeriod);
|
|
84
87
|
} catch (error) {
|
|
85
88
|
this.$message.error(error.toString());
|
|
86
89
|
}
|
|
@@ -123,7 +126,7 @@ MM_mqtt.prototype.run = function(config) {
|
|
|
123
126
|
resolve(null);
|
|
124
127
|
reject(err);
|
|
125
128
|
} else {
|
|
126
|
-
this.client.on('message', async(topic, message) => {
|
|
129
|
+
this.client.on('message', async (topic, message) => {
|
|
127
130
|
await this.receive(topic, message.toString());
|
|
128
131
|
});
|
|
129
132
|
resolve(packet);
|