WebSocketCloseReasonCode

public enum WebSocketCloseReasonCode

The WebSocketCloseReasonCode enum defines the set of reason codes that a WebSocket application can send/receive when a connection is closed.

  • Closed abnormally (1006)

    Declaration

    Swift

    case closedAbnormally
  • An extension was missing that was required (1010)

    Declaration

    Swift

    case extensionMissing
  • Server is going away (1001)

    Declaration

    Swift

    case goingAway
  • Data within a message was invalid (1007)

    Declaration

    Swift

    case invalidDataContents
  • Message was of the incorrect type (binary/text) (1003)

    Declaration

    Swift

    case invalidDataType
  • Message was too large (1009)

    Declaration

    Swift

    case messageTooLarge
  • Closed normally (1000)

    Declaration

    Swift

    case normal
  • No reason code sent with the close request (1005)

    Declaration

    Swift

    case noReasonCodeSent
  • A policy violation occurred (1008)

    Declaration

    Swift

    case policyViolation
  • A protocol error occurred (1002)

    Declaration

    Swift

    case protocolError
  • The server had an error with the request (1011)

    Declaration

    Swift

    case serverError
  • This reason code is used to send application defined reason codes.

    Declaration

    Swift

    case userDefined(UInt16)
  • Get the sixteen bit integer code for a WebSocketCloseReasonCode instance

    Declaration

    Swift

    public func code() -> UInt16
  • Convert a sixteen bit WebSocket close frame reason code to a WebSocketCloseReasonCode instance

    Declaration

    Swift

    public static func from(code reasonCode: UInt16) -> WebSocketCloseReasonCode