summaryrefslogtreecommitdiff
path: root/sw-client/src/commonMain/kotlin
diff options
context:
space:
mode:
authorJoffrey Bion <joffrey.bion@booking.com>2020-05-25 02:05:41 +0200
committerJoffrey Bion <joffrey.bion@booking.com>2020-05-25 02:05:41 +0200
commit090f1330af57a18b8f2d5113ac83c3603dc09826 (patch)
tree5bb6b3b0afa274cd6d80e75ac609dc35df582670 /sw-client/src/commonMain/kotlin
parentDisable heroku deployments from Travis CI (diff)
downloadseven-wonders-090f1330af57a18b8f2d5113ac83c3603dc09826.tar.gz
seven-wonders-090f1330af57a18b8f2d5113ac83c3603dc09826.tar.bz2
seven-wonders-090f1330af57a18b8f2d5113ac83c3603dc09826.zip
Attempt at fixing up StompSession.request()
Diffstat (limited to 'sw-client/src/commonMain/kotlin')
-rw-r--r--sw-client/src/commonMain/kotlin/org/luxons/sevenwonders/client/SevenWondersClient.kt7
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()
}
bgstack15