wx.connectSocket({
url: ‘wss://api.xxxxxx.cn/api/third/ws/’ + self.globalData.token,
header: {
“X-Access-Auth-Token”: self.globalData.token,
“Upgrade”: “websocket”
},
success() {
console.log(‘WebSocket连接已打开!’)
}
});
wx.onSocketOpen(function (res) {
console.log(‘WebSocket连接已打开!’)
})