Instance Method

sendMessage:completionHandler:

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

Declaration

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

Parameters

message

The WebSocket message to send.

completionHandler

A block that receives an NSError that indicates an error encountered while sending, or nil if no error occurred.

Discussion

If an error occurs while sending the message, any outstanding work also fails.

See Also

Sending and Receiving Data

- receiveMessageWithCompletionHandler:

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

maximumMessageSize

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