diff options
-rw-r--r-- | sw-client/src/commonMain/kotlin/org/luxons/sevenwonders/client/SevenWondersClient.kt | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/sw-client/src/commonMain/kotlin/org/luxons/sevenwonders/client/SevenWondersClient.kt b/sw-client/src/commonMain/kotlin/org/luxons/sevenwonders/client/SevenWondersClient.kt index 4e3cf4b2..5193f618 100644 --- a/sw-client/src/commonMain/kotlin/org/luxons/sevenwonders/client/SevenWondersClient.kt +++ b/sw-client/src/commonMain/kotlin/org/luxons/sevenwonders/client/SevenWondersClient.kt @@ -1,9 +1,6 @@ package org.luxons.sevenwonders.client -import kotlinx.coroutines.CoroutineStart -import kotlinx.coroutines.ExperimentalCoroutinesApi -import kotlinx.coroutines.async -import kotlinx.coroutines.coroutineScope +import kotlinx.coroutines.* import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.first import kotlinx.serialization.DeserializationStrategy @@ -36,6 +33,7 @@ class SevenWondersClient { } } +// TODO replace these calls by actual HTTP endpoints @OptIn(ExperimentalCoroutinesApi::class) private suspend inline fun <reified T : Any, reified U : Any> StompSessionWithKxSerialization.request( sendDestination: String, @@ -47,6 +45,7 @@ private suspend inline fun <reified T : Any, reified U : Any> StompSessionWithKx val sub = async(start = CoroutineStart.UNDISPATCHED) { subscribe(receiveDestination, deserializer).first() } + delay(30) // ensures the subscription happened convertAndSend(sendDestination, payload, serializer) sub.await() } |