MQTT---HIVEMQ source code specific explanation (vii) NETTY-SSL/NOSSL

Source: Internet
Author: User

SOURCE Blog Address: http://blog.csdn.net/pipinet123

MQTT Exchange Group: 221405150 Implementation Capabilities

Add different Tlswebsocketlistener to pipeline based on different user-configured listener (TcpListener, Tlstcplistener, Websocketlistener, Handler)

Implementation steps

1, according to listener different, generate different handler
2, add to pipeline. Make it available for each client

Class diagram

By being able to see that there are corresponding types of Channelinitializer to initialize the transport Channel for different listener, it is good to understand that.

1、ChannelInitializerFactory是AbstractChannelInitializer的一个工厂类,针对不同的Listener,能够生成不同的ChannelInitializer。2、ChannelInitializerFactory去推断Listener类型。去创建相应的AbstractChannelInitializer,TlsTcpChannelInitializer、WebsocketChannelInitializer、TlsWebsocketChannelInitializer都是AbstractChannelInitializer的实现类。3、通过实现AbstractChannelInitializer的initTransportChannel。将相应的Handler加入到pipeline中。4、若是TcpListener、WebsocketListener。则将NoSslHandler加入到pipeline中,来阻止ssl连接

5、SslContextStore是持有Tls和SslContext的映射关系的一个仓库。加单点说就是key为Tls,value为SslContext的map的封装类。

6、SslFactory通过Channel和Tls创建SslHandler,并设置SSLEngine,以达到SSL认证,详细的认证过程以及处理都是属于标准ssl处理流程。使用netty的SslHandler去完毕。什么是双向认证、单向认证等概念。就须要大家自行研究,不属于本博文的内容。

With this we can know that HIVEMQ is actually different from the type of listener, creating different abstractchannelinitializer, implementing the Inittransportchannel method, To add Sslhandler/nosslhandler to the pipeline.

MQTT---HIVEMQ source code specific explanation (vii) NETTY-SSL/NOSSL

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.