---
title: "urlSession(_:writeClosedFor:)"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/urlsessionstreamdelegate/urlsession(_:writeclosedfor:)"
---

# urlSession(_:writeClosedFor:)

Tells the delegate that the write side of the underlying socket has been closed.

## Declaration

```swift
optional func urlSession(_ session: URLSession, writeClosedFor streamTask: URLSessionStreamTask)
```

## Parameters

- `session`: The session containing the stream task that closed writes.
- `streamTask`: The stream task that closed writes.

## Discussion

Discussion This method may be called even if no writes are currently in progress.

## See Also

### Handling closing events

- [urlSession(_:readClosedFor:)](foundation/urlsessionstreamdelegate/urlsession(_:readclosedfor:).md)
