建立连接后成功,进入成功回调,但是onSocketOpen和onSocketMessage都不打印,求解,代码如下:
onLoad: function (options) {
wx.connectSocket({
url: ‘ws://xxx.xx.xxx:80xx/xxx/websocket/’,
data: {},
header: {
‘content-type’: ‘application/json’
},
method: ‘GET’,
success: function (socketRes) {
console.log('connect success: ', socketRes);
},
fail: function (err) {
console.log('connect error: ', err)
}
});
wx.onSocketOpen(function (res) {
console.log(‘WebSocket连接已打开!’)
})
wx.onSocketMessage(function (res) {
console.log(‘收到服务器内容:’ + res.data)
})
}
Socket连接失败,报错如下:java.security.cert.CertPathValidatorException:Trust anchor for certification path not found