From 0adc5ecf270905d565ff7dfc460f0967f356d32a Mon Sep 17 00:00:00 2001 From: joffrey-bion Date: Sun, 5 Jan 2020 12:31:46 +0100 Subject: Upgrade to Krossbow 0.4.1 --- sw-client/build.gradle.kts | 3 ++- .../org/luxons/sevenwonders/client/SevenWondersClient.kt | 12 ++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) (limited to 'sw-client') diff --git a/sw-client/build.gradle.kts b/sw-client/build.gradle.kts index 07e658d0..1f4996bc 100644 --- a/sw-client/build.gradle.kts +++ b/sw-client/build.gradle.kts @@ -3,7 +3,7 @@ plugins { id("org.jlleitschuh.gradle.ktlint") } -val krossbowVersion = "0.3.1" +val krossbowVersion = "0.4.1" kotlin { jvm() @@ -40,6 +40,7 @@ kotlin { dependencies { implementation(kotlin("stdlib-js")) implementation("org.hildan.krossbow:krossbow-client-js:$krossbowVersion") + implementation(npm("webstomp-client")) // required by krossbow } } val jsTest by getting { 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 70cefbcc..691a3f0a 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 @@ -3,8 +3,8 @@ package org.luxons.sevenwonders.client import kotlinx.coroutines.channels.ReceiveChannel import kotlinx.coroutines.channels.map import org.hildan.krossbow.client.KrossbowClient -import org.hildan.krossbow.engines.KrossbowSession -import org.hildan.krossbow.engines.KrossbowSubscription +import org.hildan.krossbow.client.KrossbowSession +import org.hildan.krossbow.client.KrossbowSubscription import org.luxons.sevenwonders.model.CustomizableSettings import org.luxons.sevenwonders.model.GameState import org.luxons.sevenwonders.model.PlayerTurnInfo @@ -29,12 +29,12 @@ class SevenWondersClient { } } -suspend inline fun KrossbowSession.request( +suspend inline fun KrossbowSession.request( sendDestination: String, receiveDestination: String, - payload: Any? = null -): T { - val sub = subscribe(receiveDestination) + payload: T? = null +): U { + val sub = subscribe(receiveDestination) send(sendDestination, payload) val msg = sub.messages.receive() sub.unsubscribe() -- cgit