summaryrefslogtreecommitdiff
path: root/sw-client/src/commonMain/kotlin/org
diff options
context:
space:
mode:
authorJoffrey Bion <joffrey.bion@booking.com>2020-03-26 20:50:25 +0100
committerJoffrey Bion <joffrey.bion@booking.com>2020-03-27 10:59:39 +0100
commite600544531764f67a5917483526d8d1941454640 (patch)
tree186f23e11b4300cdc53393ff7891592280bbc961 /sw-client/src/commonMain/kotlin/org
parentUse plain redux compose when devtools not present (diff)
downloadseven-wonders-e600544531764f67a5917483526d8d1941454640.tar.gz
seven-wonders-e600544531764f67a5917483526d8d1941454640.tar.bz2
seven-wonders-e600544531764f67a5917483526d8d1941454640.zip
Rework sagas and router to sub/unsubscribe properly
Diffstat (limited to 'sw-client/src/commonMain/kotlin/org')
-rw-r--r--sw-client/src/commonMain/kotlin/org/luxons/sevenwonders/client/SevenWondersClient.kt7
1 files changed, 5 insertions, 2 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 4acbccd9..c4293c2a 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
@@ -88,8 +88,11 @@ class SevenWondersSession(private val stompSession: StompSessionWithKxSerializat
suspend fun watchLobbyUpdates(gameId: Long): StompSubscription<LobbyDTO> =
stompSession.subscribe("/topic/lobby/$gameId/updated", LobbyDTO.serializer())
- suspend fun watchGameStart(gameId: Long): StompSubscription<Unit> =
- stompSession.subscribeEmptyMsg("/topic/lobby/$gameId/started")
+ suspend fun awaitGameStart(gameId: Long) {
+ val gameStartSubscription = stompSession.subscribeEmptyMsg("/topic/lobby/$gameId/started")
+ gameStartSubscription.messages.receive()
+ gameStartSubscription.unsubscribe()
+ }
suspend fun startGame() {
stompSession.sendEmptyMsg("/app/lobby/startGame")
bgstack15