ChannelHandlerContext

Every ChannelHandler has – when added to a ChannelPipeline – a corresponding ChannelHandlerContext which is the way ChannelHandlers can interact with other ChannelHandlers in the pipeline.

ChannelPipeline.swift:1786
final class ChannelHandlerContext

Most ChannelHandlers need to send events through the ChannelPipeline which they do by calling the respective method on their ChannelHandlerContext. In fact all the ChannelHandler default implementations just forward the event using the ChannelHandlerContext.

Many events are instrumental for a ChannelHandler’s life-cycle and it is therefore very important to send them at the right point in time. Often, the right behaviour is to react to an event and then forward it to the next ChannelHandler.