waitForMessage

abstract suspend fun waitForMessage(): ByteArray

Waits for the other peer to send a message.

This received message should be formatted as SessionEstablishment or SessionData according to ISO/IEC 18013-5:2021. Transport-specific session termination is indicated by the returned message being empty.

Return

the message that was received or empty if transport-specific session termination was used.

Throws

if close was called from another coroutine while waiting.

if an unrecoverable error occurs.