Contents

receive()

Receive an object from a connection.

Declaration

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.