<!--
{
  "availability" : [
    "iOS: 12.0.0 -",
    "iPadOS: 12.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.14.0 -",
    "tvOS: 12.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 6.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Network",
  "identifier" : "/documentation/Network/nw_ws_opcode_t",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "Network"
    ],
    "preciseIdentifier" : "c:@EA@nw_ws_opcode_t"
  },
  "title" : "nw_ws_opcode_t"
}
-->

# nw_ws_opcode_t

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

```
struct nw_ws_opcode_t
```

## Topics

### Data Types

[`nw_ws_opcode_binary`](/documentation/Network/nw_ws_opcode_binary)

A binary data message.

[`nw_ws_opcode_text`](/documentation/Network/nw_ws_opcode_text)

A text data message.

[`nw_ws_opcode_cont`](/documentation/Network/nw_ws_opcode_cont)

A continuation message.

### Control Types

[`nw_ws_opcode_ping`](/documentation/Network/nw_ws_opcode_ping)

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

[`nw_ws_opcode_pong`](/documentation/Network/nw_ws_opcode_pong)

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

[`nw_ws_opcode_close`](/documentation/Network/nw_ws_opcode_close)

A message indicating a close of the connection.

[`nw_ws_opcode_invalid`](/documentation/Network/nw_ws_opcode_invalid)

The message is not valid.

## Relationships

### Conforms To

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

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

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

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

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

---

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)