微信小程序建立WebSocket后不触发onSocketOpen
建立连接后成功,进入成功回调,但是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) }) }