Netty和SSL Websocket客户端 [英] Netty and SSL websocket client

查看:997
本文介绍了Netty和SSL Websocket客户端的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在努力使用Netty 4.0.8 Websocket客户端示例和SSL,但似乎无法将数据发送到Netty SSL Websocket服务器示例.尽管有很多关于此问题的文章,(我相信我遍历了所有内容),最常见的建议是在管道的开头添加一个sslHandler,但这是行不通的.握手似乎很成功,因为它也提示了相关问题

I'm struggling with Netty 4.0.8 Websocket client example and SSL and I can't seem to be able to send data to the Netty SSL websocket server example. Although there have been many posts around this issue, (I went through all, I believe), and the most common suggestion is to just add an sslHandler to the beginning of the pipeline, it doesn't work. Handshake seems to be successful as it is also indicated to a relevant question here.

我记得与4.0.0版本处于同一情况,但是我设法设法使其正常运行.但是,当我升级到4.0.8时,事情(和API)发生了变化.

I remember being in the same situation with version 4.0.0, but I somehow managed to get it working. However, things (and API) changed when I upgraded to 4.0.8.

Netty开发人员可以在示例中添加有效的Websocket SSL客户端示例吗?许多人都在为这个问题而苦苦挣扎,这将很有用.也许解决方案太简单了,但是通过示例可以弄清楚.再次,很抱歉重新发布了一个可能已经存在的问题,但相关问题也未得到解答,我的声誉太低,无法对其他相关问题添加评论:)

Can the Netty developers add a working Websocket SSL client example to the examples? Many people struggle with this issue and that would be useful. Maybe the solution is just too simple, but an example would clear things. Again, sorry for reposting a question that might be already there, but the relevant question has also been unanswered and my reputation is just too low to add a comment to other relevant questions :)

推荐答案

我似乎已经找到了解决自己问题的方法.客户端上的示例代码使用channel.write()方法,该方法似乎不将消息发送到Websocket ssl服务器.通过使用channel.writeAndFlush()可以将消息正确发送到服务器.

I seem to have found a solution to my own question. The sample code on the client uses the channel.write() method, which seems not to send the messages to the Websocket ssl server. By using the channel.writeAndFlush() instead, messages are correctly sent to the server.

这篇关于Netty和SSL Websocket客户端的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆