sendAndReceive

@Suspendable
inline fun <R : Any> FlowSession.sendAndReceive(payload: Any): R

Serializes and queues the given payload object for sending to the counterparty. Suspends until a response is received, which must be of the given R type.

Note that this function is not just a simple send+receive pair: it is more efficient and more correct to use this when you expect to do a message swap than do use FlowSession.send and then FlowSession.receive in turn.

Return

The received data R

Parameters

R

The data type received from the counterparty.

payload

The data sent to the counterparty.