---
title: URLSessionWebSocketTask.CloseCode.policyViolation
framework: foundation
role: symbol
role_heading: Case
path: foundation/urlsessionwebsockettask/closecode-swift.enum/policyviolation
---

# URLSessionWebSocketTask.CloseCode.policyViolation

A code that indicates an endpoint terminated the connection because it received a message that violates its policy.

## Declaration

```swift
case policyViolation
```

## Discussion

Discussion This is a generic code for use when a more specific code is unavailable.

## See Also

### Close codes

- [URLSessionWebSocketTask.CloseCode.abnormalClosure](foundation/urlsessionwebsockettask/closecode-swift.enum/abnormalclosure.md)
- [URLSessionWebSocketTask.CloseCode.goingAway](foundation/urlsessionwebsockettask/closecode-swift.enum/goingaway.md)
- [URLSessionWebSocketTask.CloseCode.internalServerError](foundation/urlsessionwebsockettask/closecode-swift.enum/internalservererror.md)
- [URLSessionWebSocketTask.CloseCode.invalid](foundation/urlsessionwebsockettask/closecode-swift.enum/invalid.md)
- [URLSessionWebSocketTask.CloseCode.invalidFramePayloadData](foundation/urlsessionwebsockettask/closecode-swift.enum/invalidframepayloaddata.md)
- [URLSessionWebSocketTask.CloseCode.mandatoryExtensionMissing](foundation/urlsessionwebsockettask/closecode-swift.enum/mandatoryextensionmissing.md)
- [URLSessionWebSocketTask.CloseCode.messageTooBig](foundation/urlsessionwebsockettask/closecode-swift.enum/messagetoobig.md)
- [URLSessionWebSocketTask.CloseCode.noStatusReceived](foundation/urlsessionwebsockettask/closecode-swift.enum/nostatusreceived.md)
- [URLSessionWebSocketTask.CloseCode.normalClosure](foundation/urlsessionwebsockettask/closecode-swift.enum/normalclosure.md)
- [URLSessionWebSocketTask.CloseCode.protocolError](foundation/urlsessionwebsockettask/closecode-swift.enum/protocolerror.md)
- [URLSessionWebSocketTask.CloseCode.tlsHandshakeFailure](foundation/urlsessionwebsockettask/closecode-swift.enum/tlshandshakefailure.md)
- [URLSessionWebSocketTask.CloseCode.unsupportedData](foundation/urlsessionwebsockettask/closecode-swift.enum/unsupporteddata.md)
