sendBlocking

inline suspend fun <Message : DomainMessage> sendBlocking(sendingCoroutineScope: CoroutineScope = CoroutineScope(Dispatchers.IO), timeoutMillis: Long = 60000, crossinline sendMessage: suspend () -> Unit): Message

Executes a message-sending action and suspends until a message of the specified type Message is received.

Return

The received message of type Message.

Parameters

Message

The specific type of DomainMessage to await.

timeoutMillis

The maximum time to wait for the response.

sendMessage

A suspend block that triggers the sending of the message.

Throws

TimeoutCancellationException

if the message is not received within the timeout.

if a message of the same type is already awaiting.