summaryrefslogtreecommitdiff
path: root/sw-client
diff options
context:
space:
mode:
Diffstat (limited to 'sw-client')
-rw-r--r--sw-client/build.gradle.kts3
-rw-r--r--sw-client/src/commonMain/kotlin/org/luxons/sevenwonders/client/SevenWondersClient.kt12
2 files changed, 8 insertions, 7 deletions
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 <reified T : Any> KrossbowSession.request(
+suspend inline fun <reified T : Any, reified U : Any> KrossbowSession.request(
sendDestination: String,
receiveDestination: String,
- payload: Any? = null
-): T {
- val sub = subscribe<T>(receiveDestination)
+ payload: T? = null
+): U {
+ val sub = subscribe<U>(receiveDestination)
send(sendDestination, payload)
val msg = sub.messages.receive()
sub.unsubscribe()
bgstack15