From 090f1330af57a18b8f2d5113ac83c3603dc09826 Mon Sep 17 00:00:00 2001 From: Joffrey Bion Date: Mon, 25 May 2020 02:05:41 +0200 Subject: Attempt at fixing up StompSession.request() --- .../kotlin/org/luxons/sevenwonders/client/SevenWondersClient.kt | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'sw-client/src/commonMain') 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 StompSessionWithKxSerialization.request( sendDestination: String, @@ -47,6 +45,7 @@ private suspend inline fun StompSessionWithKx val sub = async(start = CoroutineStart.UNDISPATCHED) { subscribe(receiveDestination, deserializer).first() } + delay(30) // ensures the subscription happened convertAndSend(sendDestination, payload, serializer) sub.await() } -- cgit