Instance Property

networkProtocolName

The network protocol used to fetch the resource.

Declaration

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. 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.

See Also

Accessing Transaction Characteristics

var isProxyConnection: Bool

A Boolean value indicating whether a proxy connection was used to fetch the resource.

var isReusedConnection: Bool

A Boolean value indicating whether a persistent connection was used to fetch the resource.

var resourceFetchType: URLSessionTaskMetrics.ResourceFetchType

A value indicating whether the resource was loaded, pushed, or retrieved from the local cache.

enum URLSessionTaskMetrics.ResourceFetchType

The manner in which a resource is fetched.