const socketTask=wx.connectSocket({
url: 'ws://192.168.203.1:8642',
success: () => {
log.info('connectSocket 连接成功')
},
})
socketTask.onOpen((res)=>{
log.info('WebSocket连接已打开!readyState=' + that.obj.localSocket.readyState)
})
socketTask.onError((res)=> {
log.info('Socket onError' ,res)
})
大部分手机都可以通信,华为荣耀 nova 连接成功,没有open回调,提示{"errMsg":"fail:url not in domain list"}
参考一下:https://developers.weixin.qq.com/community/develop/doc/000e6ccc6e8fc86a329b2f29751009?highLine=fail%253Aurl%2520not%2520in%2520domain%2520list