| | |
| | | }
|
| | | let opts = {
|
| | | // #ifdef H5
|
| | | url: 'wss://' + this.$api.mqttBaseUrl + ':8084/mqtt',
|
| | | url: 'ws://' + this.$api.mqttBaseUrl + ':8083/mqtt',
|
| | | // #endif
|
| | | // #ifdef MP-WEIXIN
|
| | | url: 'wxs://' + this.$api.mqttBaseUrl + ':8084/mqtt', // 微信小程序强制 WSS
|
| | | // #endif
|
| | | // #ifdef APP-PLUS
|
| | | url: 'wxs://' + this.$api.mqttBaseUrl + ':8084/mqtt', // Android/iOS 用普通 WebSocket
|
| | | url: 'wx://' + this.$api.mqttBaseUrl + ':8083/mqtt', // Android/iOS 用普通 WebSocket
|
| | | // #endif
|
| | | clientId: deviceid,
|
| | | username: account.username,
|
| | | password: account.password
|
| | | // username: account.username,
|
| | | // password: account.password, |
| | | //统一使用租户登录 TODO 添加多租户用户 |
| | | username: 'tongjitang', |
| | | password: '123456'
|
| | | }
|
| | | if (!this.$mqttTool.client) {
|
| | | this.$mqttTool.client = await this.$mqttTool.connect(opts);
|