onOpen fail code:8, msg:TLS handshake failed?
发布于 6 年前 作者 dqiao 12511 次浏览 来自 官方Issues

websocket连接,苹果机测试没有问题,安卓机测试全部出现exception onOpen fail code:8, msg:TLS handshake failed的报错

证书测试截图

开发者库

测试安卓版本

8.10, 10, 9

报错代码

linkSocket(){
  let that = this
  var url = 'wss://ytcloud.yungtay.com.cn:8081/ws';
  this.globalData.wxst = wx.connectSocket({
   url: url,
   method"GET",
   success() {
    console.log('连接成功')
    that.initEventHandle()
   }
  })
 },
initEventHandle(){
  let that = this
  wx.onSocketMessage((res) => {
   //收到消息
      var data = res.data;
      console.info(data);
      that.globalData.result=data
  })
  wx.onSocketOpen(()=>{
   console.log('WebSocket连接打开')
   //this._reset()._start();
  })
  wx.onSocketError(function (res{
   console.log(res)//exception onOpen fail code:8, msg:TLS handshake failed报错
   that.reconnect()
  })
  wx.onSocketClose(function (res{
   console.log('WebSocket 已关闭!')
   that.reconnect()
  })
 },
1 回复

证书问题,证书问题,重新生成证书,搞定,我用的是netty的服务器~

回到顶部