app安卓端 uni-app的websocket连接成功但是打开失败
环境:
安卓9,魅族note9
hBuilderX 3.2.9.20210927
代码如下
uni.connectSocket({
url: 'ws://10.14.31.76:8699/ws',
success: () => {
console.log('connectSocket success');
},
fail: () => {
console.log('connectSocket fail');
}
});
uni.onSocketOpen(function (res) {
console.log('WebSocket连接已打开!');
});
uni.onSocketMessage(function (res) {
console.log('收到服务器内容:' + res.data);
});
uni.onSocketError(function (res) {
console.log('WebSocket连接打开失败,请检查!', res);
});
1 个回复
Jay丶千珏 - 需求任你提,我改算我输-.-
我也出现了此情况,请问是怎么回事