<!--
{
  "availability" : [
    "iOS: 26.0.0 -",
    "iPadOS: 26.0.0 -",
    "macCatalyst: 26.0.0 -",
    "macOS: 26.0.0 -",
    "tvOS: 26.0.0 -",
    "visionOS: 26.0.0 -",
    "watchOS: 26.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Network",
  "identifier" : "/documentation/Network/WebSocket/additionalHeaders(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Network"
    ],
    "preciseIdentifier" : "s:7Network9WebSocketV17additionalHeadersyACSaySS4name_SS5valuetGF"
  },
  "title" : "additionalHeaders(_:)"
}
-->

# additionalHeaders(_:)

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

```
func additionalHeaders(_ headers: [(name: String, value: String)]) -> WebSocket
```

## Parameters

`headers`

An array of HTTP header field names and values.

## Discussion

This can be used for custom protocols and cookies.
Multiple headers of the same name are not allowed, and the
header will replaced by the most recently set value.

> Note: This function will only take effect on WebSocket clients.

---

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)