<!--
{
  "availability" : [
    "iOS: 10.0.0 -",
    "iPadOS: 10.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.12.0 -",
    "tvOS: 10.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 3.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/URLSessionTaskTransactionMetrics/networkProtocolName",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(cs)NSURLSessionTaskTransactionMetrics(py)networkProtocolName"
  },
  "title" : "networkProtocolName"
}
-->

# networkProtocolName

The network protocol used to fetch the resource.

```
var networkProtocolName: String? { get }
```

## Discussion

When a proxy is configured and a tunnel connection is established, this attribute returns the value for the tunneled protocol, which is identified by the ALPN Protocol ID Identification Sequence, as per [RFC 7310](https://tools.ietf.org/html/rfc7301). For example:

- If no proxy is used, and HTTP/2 is negotiated, then `h2` is returned.
- If HTTP/1.1 is used with the proxy, and the tunneled connection is HTTP/2, then `h2` is returned.
- If HTTP/1.1 is used with the proxy, and there’s no tunnel, then `http/1.1` is returned.

---

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)