Protocol

NSURLSessionWebSocketDelegate

A protocol that defines methods that URL session instances call on their delegates to handle task-level events specific to WebSocket tasks.

Declaration

@protocol NSURLSessionWebSocketDelegate

Topics

Handling WebSocket Lifecycle Events

- URLSession:webSocketTask:didOpenWithProtocol:

Tells the delegate that the WebSocket task successfully negotiated the handshake with the endpoint, indicating the negotiated protocol.

- URLSession:webSocketTask:didCloseWithCode:reason:

Tells the delegate that the WebSocket task received a close frame from the server endpoint, optionally including a close code and reason from the server.

Relationships

See Also

Adding WebSocket Tasks to a Session

- webSocketTaskWithURL:

Creates a WebSocket task for the provided URL.

- webSocketTaskWithRequest:

Creates a WebSocket task for the provided URL request.

- webSocketTaskWithURL:protocols:

Creates a WebSocket task given a URL and an array of protocols.

NSURLSessionWebSocketTask

A URL session task that communicates over the WebSockets protocol standard.