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

# NWProtocolWebSocket.Options

A container of options for configuring how WebSocket is used on a connection.

```
class Options
```

## Topics

### Configuring WebSocket Options

[`init(NWProtocolWebSocket.Version)`](/documentation/Network/NWProtocolWebSocket/Options/init(_:))

Initializes a default set of WebSocket connection options.

[`enum Version`](/documentation/Network/NWProtocolWebSocket/Version)

Supported versions of the WebSocket protocol.

[`var autoReplyPing: Bool`](/documentation/Network/NWProtocolWebSocket/Options/autoReplyPing)

A Boolean indicating whether the connection automatically replies to Ping messages instead of delivering them to you.

[`var maximumMessageSize: Int`](/documentation/Network/NWProtocolWebSocket/Options/maximumMessageSize)

The maximum allowed message size, in bytes, to be received by the WebSocket connection.

### Configuring Client Handshakes

[`func setAdditionalHeaders([(name: String, value: String)])`](/documentation/Network/NWProtocolWebSocket/Options/setAdditionalHeaders(_:))

Sets additional HTTP header fields to be sent by the client during the WebSocket handshake.

[`func setSubprotocols([String])`](/documentation/Network/NWProtocolWebSocket/Options/setSubprotocols(_:))

Adds to the list of supported application protocols that will be presented to a WebSocket server during connection establishment.

[`var skipHandshake: Bool`](/documentation/Network/NWProtocolWebSocket/Options/skipHandshake)

A Boolean indicating whether the WebSocket protocol skips its handshake and begins framing data once the underlying connection is established.

### Handling Server Handshakes

[`func setClientRequestHandler(DispatchQueue, handler: ([String], [(name: String, value: String)]) -> NWProtocolWebSocket.Response)`](/documentation/Network/NWProtocolWebSocket/Options/setClientRequestHandler(_:handler:))

Sets a handler to react to as a server to inbound WebSocket client handshakes.

[`struct Response`](/documentation/Network/NWProtocolWebSocket/Response)

A WebSocket handshake reponse sent from a server to a client.

## Relationships

### Conforms To

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

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

### Inherits From

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

---

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)