golang实现websocket使用ws协议我可以实现,但是按照类似方法实现wss失败。发现h5发起的websocket的wss协议请求后台没有响应。我只是把ListenAndServer改为TLS的,其他没有变。谁知道什么问题呀?
有疑问加站长微信联系(非本文作者)

golang实现websocket使用ws协议我可以实现,但是按照类似方法实现wss失败。发现h5发起的websocket的wss协议请求后台没有响应。我只是把ListenAndServer改为TLS的,其他没有变。谁知道什么问题呀?
有疑问加站长微信联系(非本文作者)
入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889
`单行代码`
已经解决,就是h5的 websocket 的 wss 协议,必须是有经过受信任的 ca 鉴证才行。这个是在网上看到的回复信息:Is your Ratchet installation configured to support secure connections (wss:)? Are your keypair and certificate correctly installed? Note also that self-signed certificates will not be accepted by a WebSocket client; it must be signed by a trusted CA
楼主好,我也遇到一样的问题,我是买的sectigo的证书,在浏览器中访问https 证书是没问题。我的代码如下:http.ListenAndServe(":9999", nil)这个加nginx是能正常wss访问的。我想省掉nginx 就改了代码 改成了err := http.ListenAndServeTLS(":443", "./t.crt", "./t.key", nil) if err != nil { log.Fatal("ListenAndServeTLS: ", err) } 也启动成功没报错,但是浏览器wss访问就是没数据。