Instance Method

receiveMessageWithCompletionHandler:

Reads a WebSocket message once all the frames of the message are available.

Declaration

- (void)receiveMessageWithCompletionHandler:(void (^)(NSURLSessionWebSocketMessage *message, NSError *error))completionHandler;

Parameters

completionHandler

A closure that receives two parameters: the WebSocket message, and an NSError that indicates an error encountered while receiving the message. The error is nil if no error occurred.

Discussion

If the task reaches the maximumMessageSize while buffering the frames, this call fails with an error.

See Also

Sending and Receiving Data

- sendMessage:completionHandler:

Sends a WebSocket message, receiving the result in a completion handler.

maximumMessageSize

The maximum number of bytes to buffer before the receive call fails with an error.