MessageToByteHandler
A handler which turns a given MessageToByteEncoder
into a ChannelOutboundHandler
that can then be added to a ChannelPipeline
.
final class MessageToByteHandler<Encoder> where Encoder : MessageToByteEncoder
See also
protocol ByteToMessageDecoder
ByteToMessageDecoder
s decode bytes in a stream-like fashion fromByteBuffer
to another message type.protocol WriteObservingByteToMessageDecoder
Some
ByteToMessageDecoder
s need to observewrite
s (which are outbound events).ByteToMessageDecoder
s which implement theWriteObservingByteToMessageDecoder
protocol will be notified about every outbound write.enum DecodingState
State of the current decoding process.
class ByteToMessageHandler<Decoder>
A handler which turns a given
ByteToMessageDecoder
into aChannelInboundHandler
that can then be added to aChannelPipeline
.protocol NIOSingleStepByteToMessageDecoder
A simplified version of
ByteToMessageDecoder
that can generate zero or one messages for each invocation ofdecode
ordecodeLast
. Havingdecode
anddecodeLast
return an optional message avoids re-entrancy problems, since the functions relinquish exclusive access to theByteBuffer
when returning. This allows for greatly simplified processing.class NIOSingleStepByteToMessageProcessor<Decoder>
NIOSingleStepByteToMessageProcessor
uses aNIOSingleStepByteToMessageDecoder
to produce messages from a stream of incoming bytes. It works likeByteToMessageHandler
but may be used outside of the channel pipeline. This allows processing of wrapped protocols in a general way.protocol MessageToByteEncoder
A protocol for straightforward encoders which encode custom messages to
ByteBuffer
s. To add aMessageToByteEncoder
to aChannelPipeline
, usechannel.pipeline.addHandler(MessageToByteHandler(myEncoder)
.
Citizens in NIOCore
Conformances
protocol ChannelHandler
Base protocol for handlers that handle I/O events or intercept an I/O operation.
protocol ChannelOutboundHandler
ChannelHandler
which handles outbound I/O events or intercept an outbound I/O operation for aChannel
.
Show implementation details (2)
Hide implementation details
protocol _ChannelOutboundHandler
Untyped
ChannelHandler
which handles outbound I/O events or intercept an outbound I/O operation.protocol _EmittingChannelHandler
ChannelHandler which will emit data by calling
ChannelHandlerContext.write
.
Typealiases
Type members
Instance features
func bind(context: ChannelHandlerContext, to: SocketAddress, promise: EventLoopPromise<Void>?
) func close(context: ChannelHandlerContext, mode: CloseMode, promise: EventLoopPromise<Void>?
) func connect(context: ChannelHandlerContext, to: SocketAddress, promise: EventLoopPromise<Void>?
) func flush(context: ChannelHandlerContext
) func read(context: ChannelHandlerContext
) func register(context: ChannelHandlerContext, promise: EventLoopPromise<Void>?
) func triggerUserOutboundEvent(context: ChannelHandlerContext, event: Any, promise: EventLoopPromise<Void>?
) func unwrapOutboundIn(NIOAny
) -> OutboundIn func wrapOutboundOut(OutboundOut
) -> NIOAny
Citizens in NIOCore
where Encoder:MessageToByteEncoder