Instance Property

closeReason

A block of data that provides further information about why a connection closed.

Declaration

@property(readonly, copy) NSData *closeReason;

Discussion

The close reason provides further information about why a connection closed, beyond that provided by the closeCode. The value of this property isn’t defined by RFC 6455; the endpoints define how it’s used.

You can retrieve the close reason at any time. When the task is not yet closed, this value is NSURLSessionWebSocketCloseCodeInvalid.

See Also

Closing the Connection

- cancelWithCloseCode:reason:

Sends a close frame with the given close code and optional close reason.

closeCode

A code that indicates the reason a connection closed.

NSURLSessionWebSocketCloseCode

A code that indicates why a WebSocket connection closed.