<!--
{
  "availability" : [
    "iOS: 26.0.0 -",
    "iPadOS: 26.0.0 -",
    "macCatalyst: 26.0.0 -",
    "macOS: 26.0.0 -",
    "tvOS: 26.0.0 -",
    "visionOS: 26.0.0 -",
    "watchOS: 26.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Network",
  "identifier" : "/documentation/Network/NetworkChannel/receive()-5p11z",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Network"
    ],
    "preciseIdentifier" : "s:7Network0A7ChannelC7receiveqd_0_7content_AA5CoderV8MetadataVyqd__qd_0_qd_1__G8metadatatyYaKAGyqd__qd_0_qd_1_GRszSERd__SeRd_0_AA0aE0Rd_1_r1_lF"
  },
  "title" : "receive()"
}
-->

# receive()

Receive an object from a connection.

```
func receive<Sending, Receiving, CoderType>() async throws -> ApplicationProtocol.Message<Receiving> where ApplicationProtocol == Coder<Sending, Receiving, CoderType>, Sending : Encodable, Receiving : Decodable, CoderType : NetworkCoder
```

## Discussion

The object will be decoded and returned. An error will
be thrown if the object cannot be decoded.

This may be called before the connection is ready, in which case
the receive request will be enqueued until the connection is ready.

---

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)