mqtt工具完善
parent
59a7d269ae
commit
8cc77d2852
|
|
@ -238,10 +238,10 @@ export default {
|
||||||
return {
|
return {
|
||||||
// MQTT配置
|
// MQTT配置
|
||||||
mqttConfig: {
|
mqttConfig: {
|
||||||
broker: 'ws://1.94.254.176:9001/mqtt', // 公共测试服务器
|
broker: '', // 公共测试服务器
|
||||||
clientId: 'uniapp_mqtt_' + Math.random().toString(16).substr(2, 8),
|
clientId: 'uniapp_mqtt_' + Math.random().toString(16).substr(2, 8),
|
||||||
username: 'admin',
|
username: '',
|
||||||
password: 'Admin#12345678',
|
password: '',
|
||||||
timeout: 30
|
timeout: 30
|
||||||
},
|
},
|
||||||
// 连接状态
|
// 连接状态
|
||||||
|
|
@ -349,7 +349,8 @@ export default {
|
||||||
password: this.mqttConfig.password,
|
password: this.mqttConfig.password,
|
||||||
connectTimeout: (this.mqttConfig.timeout || 30) * 1000,
|
connectTimeout: (this.mqttConfig.timeout || 30) * 1000,
|
||||||
keepalive: 60,
|
keepalive: 60,
|
||||||
clean: true
|
clean: true,
|
||||||
|
reconnectPeriod: 0
|
||||||
}
|
}
|
||||||
|
|
||||||
// 创建客户端并连接
|
// 创建客户端并连接
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue