Schedules a single receive completion handler for a complete message, as opposed to a range of bytes.


void nw_connection_receive_message(nw_connection_t connection, nw_connection_receive_completion_t completion);



A receive completion is invoked exactly once for a call to receive. The completion indicates that the requested content has been received (in which case the content is delivered), or else an error has occurred.

The completion delivers the received content, which may be nil if the message is complete or an error occurred, the message context, a flag indicating if the message is complete, and any associated error.


Receiving messages allows you to deal with complete datagrams or application-layer messages without needing to reconstruct a stream.

If you are using UDP, receiving a message will deliver a single datagram.

If you request to receive a message on a protocol that is otherwise an unbounded bytestream, like TCP or TLS, note that this will not deliver any data until the stream is closed by the peer.

In order to use messages on top of a bytestream protocol, add WebSocket Options or custom Framer Protocol Options to your protocol stack.

See Also

Sending and Receiving Data


Sends data on a connection.


A completion handler that indicates when the connection has finished processing sent content.


A representation of a message to send or receive, containing protocol metadata and send properties.


Schedules a single receive completion handler, with a range indicating how many bytes the handler can receive at one time.


A completion handler that indicates when content has been received by the connection, or that an error was encountered.


Defines a block in which calls to send and receive are processed as a batch to improve performance.


Accesses the maximum size of a datagram message that can be sent on a connection.