4***@qq.com
4***@qq.com
  • 发布:2023-06-06 20:18
  • 更新:2023-06-06 20:18
  • 阅读:347

【报Bug】nvue模式下 websocket 报错

分类:uni-app

产品分类: uniapp/App

PC开发环境操作系统: Windows

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

HBuilderX类型: 正式

HBuilderX版本号: 3.8.4

手机系统: Android

手机系统版本号: Android 7.1.1

手机机型: T2

页面类型: nvue

vue版本: vue2

打包方式: 离线

项目创建方式: HBuilderX

示例代码:

(function() {
const client = new Paho.Client(URL, CLIENT_ID)
client.connect({
timeout: 60,
userName: USERNAME,
password: PASSWORD,
keepAliveInterval: 30,
cleanSession: true,
useSSL: false,
reconnect: true,
onSuccess: () => {
client.subscribe("publish/topic01", {
qos: 1
})
client.onMessageArrived = (msg) => {
console.log(msg.payloadString())
}
client.onConnectionLost = (res) => {
console.log("连接断开")
console.log(res)
}
},
onFailure: (err) => {
console.log(err);
}
})
})()

// Paho 库有做调整
Client.prototype.doConnect = function(wsurl) {
/ 忽略 /
uni.connectSocket({
url: wsurl,
protocols: ['mqtt','websocket'],
success(res) {
console.log(res)
},
fail(err) {
console.log(err)
}
});

/ 忽略 /
};

操作步骤:

接收websocket消息时反复报该错误

预期结果:

接收websocket消息时不出错

实际结果:

接收websocket消息时反复报该错误

bug描述:

在自定义基座调试nvue页面时报了如下错误,这估计就是nvue接收不到websocket回馈的原因
2023-06-06 20:05:27.004 20709-20745 weex com.develop.demo E Argument value is null, df is0
2023-06-06 20:05:27.007 20709-20745 weex com.develop.demo E Argument value is null, df is0
2023-06-06 20:05:27.040 20709-20745 console com.develop.demo I [LOG]---BEGIN:JSON---{"errMsg":"connectSocket:ok"}---END:JSON--- at common/paho/paho-mqtt.js:1108
2023-06-06 20:06:31.049 20709-20745 weex com.develop.demo E Argument value is null, df is0
2023-06-06 20:06:31.053 20709-20745 weex com.develop.demo E Argument value is null, df is0
2023-06-06 20:06:31.085 20709-20745 console com.develop.demo I [LOG]---BEGIN:JSON---{"errMsg":"connectSocket:ok"}---END:JSON--- at common/paho/paho-mqtt.js:1108
2023-06-06 20:07:39.092 20709-20745 weex com.develop.demo E Argument value is null, df is0
2023-06-06 20:07:39.095 20709-20745 weex com.develop.demo E Argument value is null, df is0
2023-06-06 20:07:39.127 20709-20745 console com.develop.demo I [LOG]---BEGIN:JSON---{"errMsg":"connectSocket:ok"}---END:JSON--- at common/paho/paho-mqtt.js:1108

2023-06-06 20:18 负责人:无 分享
已邀请:

要回复问题请先登录注册