---
title: receive()
framework: network
role: symbol
role_heading: Instance Method
path: network/networkchannel/receive()-5p11z
---

# receive()

Receive an object from a connection.

## Declaration

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

## Discussion

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.
