WebSocketFrameEncoder

public final class WebSocketFrameEncoder : ChannelOutboundHandler

An inbound ChannelHandler that serializes structured websocket frames into a byte stream for sending on the network.

This encoder has limited enforcement of compliance to RFC 6455. In particular, to guarantee that the encoder can handle arbitrary extensions, only normative MUST/MUST NOTs that do not relate to extensions (e.g. the requirement that control frames not have lengths larger than 125 bytes) are enforced by this encoder.

This encoder does not have any support for encoder extensions. If you wish to support extensions, you should implement a message-to-message encoder that performs the appropriate frame transformation as needed.

  • Undocumented

    Declaration

    Swift

    public init()
  • Declaration

    Swift

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