<!--
{
  "availability" : [
    "iOS: 13.0.0 -",
    "iPadOS: 13.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.15.0 -",
    "tvOS: 13.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 6.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Network",
  "identifier" : "/documentation/Network/NWProtocolWebSocket/CloseCode/Defined",
  "metadataVersion" : "0.1.0",
  "role" : "Enumeration",
  "symbol" : {
    "kind" : "Enumeration",
    "modules" : [
      "Network"
    ],
    "preciseIdentifier" : "s:7Network19NWProtocolWebSocketC9CloseCodeO7DefinedO"
  },
  "title" : "NWProtocolWebSocket.CloseCode.Defined"
}
-->

# NWProtocolWebSocket.CloseCode.Defined

Well-known close code values.

```
enum Defined
```

## Topics

### Defined Close Codes

[`case normalClosure`](/documentation/Network/NWProtocolWebSocket/CloseCode/Defined/normalClosure)

A normal closure occurred with no errors.

[`case goingAway`](/documentation/Network/NWProtocolWebSocket/CloseCode/Defined/goingAway)

An endpoint is no longer available, such as when a server is down.

[`case protocolError`](/documentation/Network/NWProtocolWebSocket/CloseCode/Defined/protocolError)

An endpoint is terminating the connection due to a protocol error.

[`case unsupportedData`](/documentation/Network/NWProtocolWebSocket/CloseCode/Defined/unsupportedData)

An endpoint is terminating the connection because it received a type of data it cannot accept.

[`case noStatusReceived`](/documentation/Network/NWProtocolWebSocket/CloseCode/Defined/noStatusReceived)

This value is reserved for local errors and indicates that no Close code was received.

[`case abnormalClosure`](/documentation/Network/NWProtocolWebSocket/CloseCode/Defined/abnormalClosure)

This value is reserved for local errors and indicates that no Close message was received.

[`case invalidFramePayloadData`](/documentation/Network/NWProtocolWebSocket/CloseCode/Defined/invalidFramePayloadData)

An endpoint is terminating the connection because it received data within a message that was inconsistent with the message type.

[`case policyViolation`](/documentation/Network/NWProtocolWebSocket/CloseCode/Defined/policyViolation)

An endpoint is terminating the connection because it received a message that violates its policy.

[`case messageTooBig`](/documentation/Network/NWProtocolWebSocket/CloseCode/Defined/messageTooBig)

An endpoint is terminating the connection because it received a message that is too big for it to process.

[`case mandatoryExtension`](/documentation/Network/NWProtocolWebSocket/CloseCode/Defined/mandatoryExtension)

The WebSocket client expected the server to negotiate one or more extensions that were not negotiated.

[`case internalServerError`](/documentation/Network/NWProtocolWebSocket/CloseCode/Defined/internalServerError)

The server is terminating the connection because it encountered an unexpected condition that prevented it from fulfilling the request.

[`case tlsHandshake`](/documentation/Network/NWProtocolWebSocket/CloseCode/Defined/tlsHandshake)

This value is reserved for local errors and indicates that the TLS handshake failed.

### Close Codes Comparison Functions

## Relationships

### Conforms To

[`Escapable`](/documentation/Swift/Escapable)

[`RawRepresentable`](/documentation/Swift/RawRepresentable)

[`Sendable`](/documentation/Swift/Sendable)

[`SendableMetatype`](/documentation/Swift/SendableMetatype)

[`Hashable`](/documentation/Swift/Hashable)

[`Equatable`](/documentation/Swift/Equatable)

[`Copyable`](/documentation/Swift/Copyable)

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)