收藏
回答

onOpen fail code:8, msg:TLS handshake failed?

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 个回答

  • 陆跑跑已胖哭 😢
    陆跑跑已胖哭 😢
    2020-06-22

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

    2020-06-22
    有用
    回复 2
    • Mimicry`👁
      Mimicry`👁
      2021-04-07
      具体什么问题啊?  我是腾讯云上申请的证书``安卓系统也报一样的错
      2021-04-07
      回复
    • .
      .
      2022-01-12回复Mimicry`👁
      解决了么 我也遇到这个问题苹果手机微信小程序是好的 安卓的不行
      2022-01-12
      回复
登录 后发表内容
问题标签