diff options
author | Joffrey Bion <joffrey.bion@booking.com> | 2020-03-26 20:50:25 +0100 |
---|---|---|
committer | Joffrey Bion <joffrey.bion@booking.com> | 2020-03-27 10:59:39 +0100 |
commit | e600544531764f67a5917483526d8d1941454640 (patch) | |
tree | 186f23e11b4300cdc53393ff7891592280bbc961 /sw-client/src/commonMain | |
parent | Use plain redux compose when devtools not present (diff) | |
download | seven-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')
-rw-r--r-- | sw-client/src/commonMain/kotlin/org/luxons/sevenwonders/client/SevenWondersClient.kt | 7 |
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") |