Sends a close frame with the given close code and optional close reason.
- iOS 13.0+
- macOS 10.15+
- Mac Catalyst 13.0+
- tvOS 13.0+
- watchOS 6.0+
URLSessionthat indicates the reason for closing the connection.
Web Socket Task .Close Code
Optional further information to explain the closing. The value of this parameter is defined by the endpoints, not by the standard.
If you call
cancel() on the task instead of this method, it sends a cancellation frame with no close code or reason.