Classes

The following classes are available globally.

  • A HTTPServerProtocolUpgrader that knows how to do the WebSocket upgrade dance.

    Users may frequently want to offer multiple websocket endpoints on the same port. For this reason, this WebServerSocketUpgrader only knows how to do the required parts of the upgrade and to complete the handshake. Users are expected to provide a callback that examines the HTTP headers (including the path) and determines whether this is a websocket upgrade request that is acceptable to them.

    This upgrader assumes that the HTTPServerUpgradeHandler will appropriately mutate the pipeline to remove the HTTP ChannelHandlers.

    See more

    Declaration

    Swift

    public final class NIOWebSocketServerUpgrader : HTTPServerProtocolUpgrader
  • An inbound ChannelHandler that deserializes websocket frames into a structured format for further processing.

    This decoder has limited enforcement of compliance to RFC 6455. In particular, to guarantee that the decoder 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 decoder.

    This decoder does not have any support for decoding extensions. If you wish to support extensions, you should implement a message-to-message decoder that performs the appropriate frame transformation as needed. All the frame data is assumed to be application data by this parser.

    See more

    Declaration

    Swift

    public final class WebSocketFrameDecoder : ByteToMessageDecoder
  • 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.

    See more

    Declaration

    Swift

    public final class WebSocketFrameEncoder : ChannelOutboundHandler
  • A simple ChannelHandler that catches protocol errors emitted by the WebSocketFrameDecoder and automatically generates protocol error responses.

    This ChannelHandler provides default error handling for basic errors in the WebSocket protocol, and can be used by users when custom behaviour is not required.

    See more

    Declaration

    Swift

    public final class WebSocketProtocolErrorHandler : ChannelInboundHandler