| | |
| | |
|
| | |
|
| | | },
|
| | | destroyed() {
|
| | | console.error("MQTT组件销毁")
|
| | | this.$mqttTool.end().then(res => {
|
| | | console.error(res)
|
| | | })
|
| | | },
|
| | | methods: {
|
| | | initMqtt() {
|
| | | uni.getSystemInfo({
|
| | |
| | | |
| | | //订阅干燥设备连接断开状态更新-租户内所有设备 |
| | | this.$mqttTool.subscribe({ |
| | | topic: this.$constant.SERVICE_BROADCAST_TENANT_UPDATE_EQU_STATU.replace('%s', this.tenantId), |
| | | topic: this.$constant.SERVICE_BROADCAST_TENANT_UPDATE_EQU_STATU.replace('%s', this
|
| | | .tenantId),
|
| | | qos: 0 |
| | | }).then(res => { |
| | | console.error(res) |
| | |
| | | })
|
| | | client.on('message', function(topic, message, buffer) {
|
| | | uni.$emit(that.$constant.MQTT_TOPIC_MESSAGE, message);
|
| | | console.error("收到message(总):"+topic)
|
| | | //console.error("收到message(总):"+topic)
|
| | |
|
| | |
|
| | | })
|