awaitEvent

suspend fun <T> ReceiveChannel<T>.awaitEvent(name: String? = null): Event<T>

Assert that an event was received and return it. This function will suspend if no events have been received.

This function will always return a terminal event on a closed ReceiveChannel.