ChannelInboundInvoker

public protocol ChannelInboundInvoker

Fire inbound events related to a Channel through the ChannelPipeline until its end is reached or it’s consumed by a ChannelHandler.

  • Called once a Channel was registered to its EventLoop and so IO will be processed.

    Declaration

    Swift

    func fireChannelRegistered()
  • Called once a Channel was unregistered from its EventLoop which means no IO will be handled for a Channel anymore.

    Declaration

    Swift

    func fireChannelUnregistered()
  • Called once a Channel becomes active.

    What active means depends on the Channel implementation and semantics. For example for TCP it means the Channel is connected to the remote peer.

    Declaration

    Swift

    func fireChannelActive()
  • Called once a Channel becomes inactive.

    What inactive means depends on the Channel implementation and semantics. For example for TCP it means the Channel was disconnected from the remote peer and closed.

    Declaration

    Swift

    func fireChannelInactive()
  • Called once there is some data read for a Channel that needs processing.

    Declaration

    Swift

    func fireChannelRead(_ data: NIOAny)
  • Called once there is no more data to read immediately on a Channel. Any new data received will be handled later.

    Declaration

    Swift

    func fireChannelReadComplete()
  • Called when a Channel‘s writable state changes.

    The writability state of a Channel depends on watermarks that can be set via Channel.setOption and how much data is still waiting to be transferred to the remote peer. You should take care to enforce some kind of backpressure if the channel becomes unwritable which means Channel.isWritable will return false to ensure you do not consume too much memory due to queued writes. What exactly you should do here depends on the protocol and other semantics. But for example you may want to stop writing to the Channel until Channel.writable becomes true again or stop reading at all.

    Declaration

    Swift

    func fireChannelWritabilityChanged()
  • Called when an inbound operation Error was caught.

    Be aware that for inbound operations this method is called while for outbound operations defined in ChannelOutboundInvoker the EventLoopFuture or EventLoopPromise will be notified.

    Declaration

    Swift

    func fireErrorCaught(_ error: Error)
  • Trigger a custom user inbound event which will flow through the ChannelPipeline.

    Declaration

    Swift

    func fireUserInboundEventTriggered(_ event: Any)