wx.connectSocket({
url: ‘wss://xxx.xxxxx.com’,
data: {},
method: ‘GET’,
success: function (res) {
console.log(“connectSocket 成功”);
},
fail: function (res) {
console.log(“connectSocket 失败”)
}
})
wx.onSocketOpen(function (res) {
console.log(“socket打开”);
wx.sendSocketMessage({
success: function (res) {
},
fail: function (res) {
}
});
wx.onSocketMessage(function (data) {
console.log(data);
console.log(‘接收到信息’);
}),
wx.onSocketClose(function (data) {
console.log(‘已经退出成功’);
})
})
},
在android上,可以执行onSocketOpen,在IOS上执行不了,这个是什么原因?要怎么解决?谢谢!急!