kl_____
kl_____
  • 发布:2023-02-08 14:41
  • 更新:2023-02-08 14:41
  • 阅读:528

【报Bug】mqtt在新版本中存在一直重连问题

分类:HBuilderX

产品分类: HbuilderX

PC开发环境操作系统: Windows

PC开发环境操作系统版本号: 10

HBuilderX版本号: 3.6.14

操作步骤:

拉取组件库直接在app中运行即可

预期结果:

connect() {
var self = this
self.logs.push('connect')
var mqtt = require('mqtt/dist/mqtt.js')
// #ifdef H5
var client = mqtt.connect('ws://test.mosquitto.org:8080')
// #endif
// #ifdef MP-WEIXIN||APP-PLUS
var client = mqtt.connect('wx://test.mosquitto.org:8080')
// #endif
client.on('connect', function() {
self.logs.push('on connect')
client.subscribe('presence', function(err) {
if (!err) {
client.publish('presence', 'hello mqtt')
}
})
}).on('reconnect', function() {
self.logs.push('on reconnect')
}).on('error', function() {
self.logs.push('on error')
}).on('end', function() {
self.logs.push('on end')
}).on('message', function(topic, message) {
console.log(message)
self.logs.push(message.toString())
})
}

实际结果:

14:17:00.606 hello mqtt at pages/index/index.vue:55
14:20:02.099 hello mqtt at pages/index/index.vue:55
14:22:03.582 hello mqtt at pages/index/index.vue:55
14:24:05.027 hello mqtt at pages/index/index.vue:55
14:26:06.304 hello mqtt at pages/index/index.vue:55
14:28:07.954 hello mqtt at pages/index/index.vue:55
14:31:09.332 hello mqtt at pages/index/index.vue:55
14:33:10.784 hello mqtt at pages/index/index.vue:55

一直在重连中。。。

bug描述:

在以往的组件库中和评论中看到的结果是mqtt在3.0.0是稳定状态;看评论在9月份之后hbuilder貌似就不能再使用了,就目前测试两个版本都是无效,mqtt一直再重连【3.6.14,3.6.15】。
使用 https://ext.dcloud.net.cn/plugin?id=854 这个组件且 mqtt在3.0.0的情况下,demo存在一直重连问题

2023-02-08 14:41 负责人:无 分享
已邀请:

要回复问题请先登录注册