lidashuang1996 / p6e_netty_websocket_client

这是一个使用 java 语言,用 netty 框架编写的 Web Socket Client。使用非常简单,支持携带请求头和 cookie 进行请求连接,支持同步、异步处理服务端推送过来的消息。
MIT License
16 stars 5 forks source link

wss的模式,始终有错误 #2

Open YukiYlf opened 4 years ago

YukiYlf commented 4 years ago

mio.netty.handler.codec.http.websocketx.WebSocketHandshakeException: Invalid handshake response getStatus: 400 Bad Request at io.netty.handler.codec.http.websocketx.WebSocketClientHandshaker.finishHandshake(WebSocketClientHandshaker.java:302) at com.p6e.netty.websocket.client.model.P6eModelHandler.channelRead(P6eModelHandler.java:69)

YukiYlf commented 4 years ago

用前端语言是可以的,能正常使用,现在是用在后台JAVA端client不行*

lidashuang1996 commented 4 years ago

方便把你的 WSS 地址给我访问测试一下吗? 我这边测试斗鱼的 WSS 连接 以及 BLIBLI 的 WSS 连接是可以的。400 可能是在 WebSocket 连接开始的时候 HTTP 握手的时候被拒绝连接了。可能是因为你请求头缺少浏览器相关信息的数据,他们服务器直接断开连接了。我们可以添加请求头里面的数据,来处理这种问题。最好是吧你的 WSS 地址(外网地址),给我测试一下。

YukiYlf commented 4 years ago

这个是没办法外网的,是硬件设备

lidashuang1996 commented 4 years ago

硬件设备支持 WS 连接吗?

YukiYlf commented 4 years ago

不支持,不过用前端语言可以

lidashuang1996 commented 4 years ago

我现在去查看一下问题。争取明天解决这个问题。

---原始邮件--- 发件人: "Yuki"<notifications@github.com> 发送时间: 2020年5月21日(周四) 晚上11:40 收件人: "lidashuang1996/p6e_netty_websocket_client"<p6e_netty_websocket_client@noreply.github.com>; 抄送: "Comment"<comment@noreply.github.com>;"LiDaShuang"<1294935733@qq.com>; 主题: Re: [lidashuang1996/p6e_netty_websocket_client] wss的模式,始终有错误 (#2)

这个是没办法外网的,是硬件设备

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

YukiYlf commented 4 years ago

不过本地前端语言访问WSS时候是先访问另外一个http的网址

lidashuang1996 commented 4 years ago

websockt 协议,就是用的http协议的升级。所以他也会,三次握手,建立通讯。你400的问题,可能是,你wss地址采用了ip地址直接连接,tsl是根据域名判断请求是否合法。如果不是这个原因,还有可能是采用了nginx对wss进行加密认证.配置文件缺少参数,导致的。 你现在,要注意的是,是否是用的ip地址,是否才用了nginx配置tsl。

---原始邮件--- 发件人: "Yuki"<notifications@github.com> 发送时间: 2020年5月21日(周四) 晚上11:55 收件人: "lidashuang1996/p6e_netty_websocket_client"<p6e_netty_websocket_client@noreply.github.com>; 抄送: "Comment"<comment@noreply.github.com>;"LiDaShuang"<1294935733@qq.com>; 主题: Re: [lidashuang1996/p6e_netty_websocket_client] wss的模式,始终有错误 (#2)

不过本地前端语言访问WSS时候是先访问另外一个http的网址

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

YukiYlf commented 4 years ago

在前端页面是IP地址的,没问题

YukiYlf commented 4 years ago

WSS浏览器有证书,前端没有问题

lidashuang1996 commented 4 years ago

可否让我远程看看问题 ?

YukiYlf commented 4 years ago

ky

lidashuang1996 commented 4 years ago

加我QQ吧,1294935733

YukiYlf commented 4 years ago

加我一下,刚才电话

------------------ 原始邮件 ------------------jiaow 发件人: "LiDaShuang"<notifications@github.com>; 发送时间: 2020年5月22日(星期五) 中午11:23 收件人: "lidashuang1996/p6e_netty_websocket_client"<p6e_netty_websocket_client@noreply.github.com>; 抄送: "快乐的小小鱼"<413166389@qq.com>;"Author"<author@noreply.github.com>; 主题: Re: [lidashuang1996/p6e_netty_websocket_client] wss的模式,始终有错误 (#2)

加我QQ吧,1294935733

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

YukiYlf commented 4 years ago

确认一下