# \[Pitch\] Ultra-Constrained Networking in URLSession on Darwin

**URL:** <https://forums.swift.org/t/pitch-ultra-constrained-networking-in-urlsession-on-darwin/82345>\
**Category:** Related Projects\
**Tags:** foundation\
**Created:** [September 24, 2025, 9:52pm UTC](https://forums.swift.org/t/pitch-ultra-constrained-networking-in-urlsession-on-darwin/82345 "2025-09-24T21:52:39Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![travarin](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/travarin/32/42951_2.png) [@travarin](https://forums.swift.org/u/travarin)\
**Post date:** [September 24, 2025, 9:52pm UTC](https://forums.swift.org/t/pitch-ultra-constrained-networking-in-urlsession-on-darwin/82345/1 "2025-09-24T21:52:39Z")

</div>

Hi all, I’d like to share a proposal for introducing a new API on URLSession for using ultra-constrained interfaces. The API is not currently available on non-Darwin platforms. Please check out the details below.

# URLSession Ultra-Constrained Network Access API

- Proposal: SF-NNNN
- Author: [Travis Langston](https://github.com/travarin)
- Review Manager: TBD
- Status: **Pitch**
- Implementation: Pending

## Introduction

Apps on Darwin are able to check if a network path uses an interface that is considered ultra-constrained by the system through the `isUltraConstrained` property on NWPath, and can then adjust whether a particular connection is allowed to use those interfaces through the `allowUltraConstrainedPaths` property on the `NWParameters`. In this proposal, we're introducing an API to allow apps that use URLSession on Darwin to also have this same capability of checking whether using ultra-constrained interfaces is currently allowed and specifying whether a particular session or request are allowed to use them.

## Proposed solution

The proposed solution involves three changes:

- Add a `allowsUltraConstrainedNetworkAccess` property on `URLSessionConfiguration`, to parallel existing properties like `allowsExpensiveNetworkAccess` and `allowsConstrainedNetworkAccess`.

- Add a `allowsUltraConstrainedNetworkAccess` property on `URLRequest`, to parallel existing properties like `allowsExpensiveNetworkAccess` and `allowsConstrainedNetworkAccess`.

- Add a new enum value `NSURLErrorNetworkUnavailableReasonUltraConstrained` for `NSURLErrorNetworkUnavailableReason`, to parallel existing values like `NSURLErrorNetworkUnavailableReasonExpensive` and `NSURLErrorNetworkUnavailableReasonConstrained`.

These flags are not available on non-Darwin platforms at this moment.

## Example usage

The following example allows an application to explicitly allow the task that follows to go over ultra-constrained interfaces.

```swift
let configuration = URLSessionConfiguration.default
configuration.allowsUltraConstrainedNetworkAccess = true

let session = URLSession(configuration: configuration)
let (data, response) = try await session.data(from: url)

```

Explicitly opting out a particular request, preventing it from being made over ultra-constrained interfaces.

```swift
var request = URLRequest(url: URL(string: "https://www.example.com")!)
request.allowsUltraConstrainedNetworkAccess = false
let task = session.dataTask(with: request) { data, response, error in
    // Handle response
}
task.resume()

```

## Detailed design

We add a new property to `URLSessionConfiguration` that lets a caller control whether URLSession is allowed to use ultra-constrained network paths.

```swift
open class URLSessionConfiguration : NSObject, NSCopying, @unchecked Sendable {

...
    @available(*, unavailable, message: "Not available on non-Darwin platforms")
    open var allowsUltraConstrainedNetworkAccess : Bool
...

}

```

We also add a new property to `URLRequest` that lets a caller set if that particular request is allowed to use ultra-constrained network paths. Explicitly setting the property on the `URLRequest` used to create the `URLSessionTask` would override the `URLSessionConfiguration` setting.

```swift
public struct URLRequest {

...
    @available(*, unavailable, message: "Not available on non-Darwin platforms")
    open var allowsUltraConstrainedNetworkAccess : Bool
...

}

```

Finally we add a new enum value to NetworkUnavailableReason which can be returned in the userInfo dictionary with the key `NSURLErrorNetworkUnavailableReasonKey` to indicate connectivity was unavailable because the only routes available were ultra constrained and this did not meet the constraints set on the task.

```swift
/// Reasons used by URLError to indicate that a URLSessionTask failed because of unsatisfiable network constraints.
public enum NetworkUnavailableReason : Int, Sendable {
    @available(*, unavailable, message: "Not available on non-Darwin platforms")
    case ultraConstrained
}

```

## Source compatibility

No impact.

## Implications on adoption

This feature can be freely adopted and un-adopted in source code with no deployment constraints and without affecting source compatibility.

## Alternatives considered

The biggest question here is the name of the property. "Ultra-constrained" is the name we have in the Network.framework API, and this proposal adds a corresponding API to URLSession.

---

<div class="post-metadata">

**Author:** ![KeithBauerANZ](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/keithbaueranz/32/27897_2.png) [@KeithBauerANZ](https://forums.swift.org/u/KeithBauerANZ)\
**Post date:** [September 24, 2025, 10:29pm UTC](https://forums.swift.org/t/pitch-ultra-constrained-networking-in-urlsession-on-darwin/82345/2 "2025-09-24T22:29:32Z")

</div>

This feature seems to be entirely undocumented; this is all I can find, and says less than nothing:

> **[isUltraConstrained | Apple Developer Documentation](https://developer.apple.com/documentation/network/nwpath/isultraconstrained)**
>
> Checks if the path uses an NWInterface that is considered to be constrained by user preference

---

<div class="post-metadata">

**Author:** ![glhaynes](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/glhaynes/32/30039_2.png) [@glhaynes](https://forums.swift.org/u/glhaynes)\
**Post date:** [September 25, 2025, 1:09pm UTC](https://forums.swift.org/t/pitch-ultra-constrained-networking-in-urlsession-on-darwin/82345/3 "2025-09-25T13:09:59Z")

</div>

For those like me who weren’t previously familiar with the term “ultra constrained network”, I believe an example would be connection with a satellite. [Ultra-Constrained networks and URL… | Apple Developer Forums](https://developer.apple.com/forums/thread/795827)

Might be a good idea to specify that in the pitch.
