<!--
{
  "availability" : [
    "iOS: 12.0.0 -",
    "iPadOS: 12.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.14.0 -",
    "tvOS: 12.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 6.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Network",
  "identifier" : "/documentation/Network/nw_content_context_t",
  "metadataVersion" : "0.1.0",
  "role" : "Type Alias",
  "symbol" : {
    "kind" : "Type Alias",
    "modules" : [
      "Network"
    ],
    "preciseIdentifier" : "c:@T@nw_content_context_t"
  },
  "title" : "nw_content_context_t"
}
-->

# nw_content_context_t

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

```
typealias nw_content_context_t = any OS_nw_content_context
```

## 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(_:_:)`](/documentation/Network/nw_content_context_set_metadata_for_protocol(_:_:)).

## Topics

### Creating Custom Send Contexts

[`nw_content_context_create(_:)`](/documentation/Network/nw_content_context_create(_:))

Initializes a custom message context.

[`nw_content_context_set_metadata_for_protocol(_:_:)`](/documentation/Network/nw_content_context_set_metadata_for_protocol(_:_:))

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

[`nw_protocol_metadata_t`](/documentation/Network/nw_protocol_metadata_t)

The abstract superclass for specifying metadata about a network protocol.

[`nw_content_context_set_antecedent(_:_:)`](/documentation/Network/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(_:)`](/documentation/Network/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(_:_:)`](/documentation/Network/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(_:)`](/documentation/Network/nw_content_context_get_expiration_milliseconds(_:))

Accesses the expiration set for this message context.

[`nw_content_context_set_relative_priority(_:_:)`](/documentation/Network/nw_content_context_set_relative_priority(_:_:))

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

[`nw_content_context_get_relative_priority(_:)`](/documentation/Network/nw_content_context_get_relative_priority(_:))

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

[`nw_content_context_set_is_final(_:_:)`](/documentation/Network/nw_content_context_set_is_final(_:_:))

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

[`nw_content_context_get_identifier(_:)`](/documentation/Network/nw_content_context_get_identifier(_:))

Accesses the identifier used to create this message context.

### Inspecting Receive Contexts

[`nw_content_context_get_is_final(_:)`](/documentation/Network/nw_content_context_get_is_final(_:))

Checks whether this context represents the final message being received.

[`nw_content_context_copy_protocol_metadata(_:_:)`](/documentation/Network/nw_content_context_copy_protocol_metadata(_:_:))

Retreives the metadata associated with a specific protocol.

[`nw_content_context_foreach_protocol_metadata(_:_:)`](/documentation/Network/nw_content_context_foreach_protocol_metadata(_:_:))

Iterates through all protocol metadata associated with the message context.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)