<!--
{
  "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/Opcode",
  "metadataVersion" : "0.1.0",
  "role" : "Enumeration",
  "symbol" : {
    "kind" : "Enumeration",
    "modules" : [
      "Network"
    ],
    "preciseIdentifier" : "s:7Network19NWProtocolWebSocketC6OpcodeO"
  },
  "title" : "NWProtocolWebSocket.Opcode"
}
-->

# NWProtocolWebSocket.Opcode

Types of messages that you send and receive on a WebSocket connection.

```
enum Opcode
```

## Topics

### Data Types

[`case binary`](/documentation/Network/NWProtocolWebSocket/Opcode/binary)

A binary data message.

[`case text`](/documentation/Network/NWProtocolWebSocket/Opcode/text)

A text data message.

[`case cont`](/documentation/Network/NWProtocolWebSocket/Opcode/cont)

A continuation message.

### Control Types

[`case ping`](/documentation/Network/NWProtocolWebSocket/Opcode/ping)

A Ping message, which requests a Pong from the peer.

[`case pong`](/documentation/Network/NWProtocolWebSocket/Opcode/pong)

A Pong message in response to a Ping from the peer.

[`case close`](/documentation/Network/NWProtocolWebSocket/Opcode/close)

A message indicating a close of the connection.

### Type Comparison Functions

## Relationships

### Conforms To

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

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

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

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

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

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

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

---

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)