ios 和开发工具都可以连接wss 唯独安卓手机不行,麻烦官方看看?
//index.js
//获取应用实例
const app = getApp()
Page({
data: {
motto: 'Hello World',
userInfo: {},
hasUserInfo: false,
param:{},
canIUse: wx.canIUse('button.open-type.getUserInfo')
},
//事件处理函数
bindViewTap: function() {
wx.navigateTo({
url: '../logs/logs'
})
},
onLoad: function () {
var task = wx.connectSocket({
url: 'wss://tj.lxp226234.top:7272/wss',
header:{
'content-type': 'application/json'
},
complete:function(r){
console.log(r)
}
})
console.log(task)
task.onOpen(function(){
console.log("成功")
})
task.onMessage(function(r){
console.log("收到消息:",r)
})
},
})