The concept and working principle of Android Netty-based message push scheme (II.)

Source: Internet
Author: User

in the previous article I described the scenario for message push and a simple Hello world based on the Netty implementation. To better understand the code in Hello World, let me explain some of the concepts and working principles of Netty today, assuming you think this article is a bit boring. Please read the Hello World(i) of Android Netty-based message push scheme first

channeleventNetty is event-driven, as we mentioned above. What happened. The "relevant department" is notified.

So. Not hard to understand. In our own business code, there must be processing related to these events. In the example code, we deal with the event that is channelconnected.

later. We will also deal with many other events.




ChannelpipelinePipelines, transmission pathways. It controls the distribution and delivery of channelevent events. The event flows through the pipeline. This is the channelpipeline to deal with.

Analogy: Development events. Give a design first. And then to B development. A flow chart. Hope to give you a more intuitive feeling.




pipe Flow diagram :



ChannelhandlerJust said pipeline is responsible for distributing the incident to the corresponding website. Website in Netty refers to Channelhandler. The incident to Channelhandler here, is to be dealt with in detail, in our example code, the implementation of this is a "site" to deal with the event, that is, your own business logic is generally started from here.
ChannelChannel , which can tell you the status of the current channel, together or off. Gets the channel-related configuration information. Get pipeline and so on. Are some of the overall information. The channel is naturally produced by ChannelFactory. The implementation type of the channel. Determines whether your channel is synchronous or asynchronous (NIO). For example, Nioserversocketchannel is used in our example.





If you are interested, please continue to understand the Netty"Android Netty-based message push scheme string for receiving and sending (iii)"

The concept and working principle of Android Netty-based message push scheme (II.)

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.