Documentation Language: Swift

Method

write(context:data:promise:)

Called to request a write operation. The write operation will write the messages through the ChannelPipeline. Those are then ready to be flushed to the actual Channel when Channel.flush or ChannelHandlerContext.flush is called.

func write(context: ChannelHandlerContext, data: NIOAny, promise: EventLoopPromise<Void>?)

Parameters

context

The ChannelHandlerContext which this ChannelHandler belongs to.

data

The data to write through the Channel, wrapped in a NIOAny.

promise

The EventLoopPromise which should be notified once the operation completes, or nil if no notification should take place.

Discussion

This should call context.write to forward the operation to the next _ChannelOutboundHandler in the ChannelPipeline or complete the EventLoopPromise to let the caller know that the operation completed.