Type Alias

nw_content_context_t

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

Declaration

typedef NSObject<OS_nw_content_context> *nw_content_context_t;

Discussion

For sending, you should use NW_CONNECTION_DEFAULT_MESSAGE_CONTEXT unless there is a reason to override some values.

You can pass NW_CONNECTION_FINAL_MESSAGE_CONTEXT to mark the final message in a connection. Once this context is used for sending, and the send is marked as complete, no more data can be sent on the connection.

If you are using a protocol that expects message content, like WebSocket or a custom framer, create a custom context and set metadata using nw_content_context_set_metadata_for_protocol.

Topics

Creating Custom Send Contexts

nw_content_context_create

Initializes a custom message context.

nw_content_context_set_metadata_for_protocol

Sets protocol metadata to configure per-message or per-packet properties.

nw_protocol_metadata_t

The abstract superclass for specifying metadata about a network protocol.

nw_content_context_set_antecedent

Set an optional message context that must be sent before the context you are sending.

nw_content_context_copy_antecedent

Accesses the optional message context that must be sent before the context you are sending.

nw_content_context_set_expiration_milliseconds

Sets the number of milliseconds after which sending the data associated with this context must begin, otherwise the data is discarded.

nw_content_context_get_expiration_milliseconds

Accesses the expiration set for this message context.

nw_content_context_set_relative_priority

Sets the relative value of priority used to reorder contexts when sending.

nw_content_context_get_relative_priority

Accesses the relative value of priority used to reorder contexts when sending.

nw_content_context_set_is_final

Sets a Boolean indicating if this context represents the final message being sent.

nw_content_context_get_identifier

Accesses the identifier used to create this message context.

Inspecting Receive Contexts

nw_content_context_get_is_final

Checks whether this context represents the final message being received.

nw_content_context_copy_protocol_metadata

Retreives the metadata associated with a specific protocol.

nw_content_context_foreach_protocol_metadata

Iterates through all protocol metadata associated with the message context.

See Also

Sending and Receiving Data

nw_connection_send

Sends data on a connection.

nw_connection_send_completion_t

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

nw_connection_receive

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

nw_connection_receive_completion_t

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

nw_connection_receive_message

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

nw_connection_batch

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

nw_connection_get_maximum_datagram_size

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