diff options
Diffstat (limited to 'kvision-modules/kvision-remote/src/main/kotlin')
2 files changed, 5 insertions, 4 deletions
diff --git a/kvision-modules/kvision-remote/src/main/kotlin/pl/treksoft/kvision/remote/KVRemoteAgent.kt b/kvision-modules/kvision-remote/src/main/kotlin/pl/treksoft/kvision/remote/KVRemoteAgent.kt index 9c6f8274..d3331b2a 100644 --- a/kvision-modules/kvision-remote/src/main/kotlin/pl/treksoft/kvision/remote/KVRemoteAgent.kt +++ b/kvision-modules/kvision-remote/src/main/kotlin/pl/treksoft/kvision/remote/KVRemoteAgent.kt @@ -21,6 +21,7 @@ */ package pl.treksoft.kvision.remote +import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.Job import kotlinx.coroutines.asDeferred import kotlinx.coroutines.channels.Channel @@ -41,7 +42,7 @@ import kotlin.js.JSON as NativeJSON * Client side agent for JSON-RPC remote calls. */ @Suppress("LargeClass", "TooManyFunctions") -@UseExperimental(ImplicitReflectionSerializer::class) +@UseExperimental(ImplicitReflectionSerializer::class, ExperimentalCoroutinesApi::class) open class KVRemoteAgent<T : Any>(val serviceManager: KVServiceManager<T>) : RemoteAgent { val callAgent = CallAgent() @@ -407,7 +408,7 @@ open class KVRemoteAgent<T : Any>(val serviceManager: KVServiceManager<T>) : Rem responseJob = launch { while (true) { val str = socket.receiveOrNull() ?: break - val data = kotlin.js.JSON.parse<dynamic>(str).result + val data = kotlin.js.JSON.parse<JsonRpcResponse>(str).result ?: "" val par2 = try { @Suppress("UNCHECKED_CAST") deserialize<PAR2>(data, PAR2::class.js.name) @@ -477,7 +478,7 @@ open class KVRemoteAgent<T : Any>(val serviceManager: KVServiceManager<T>) : Rem responseJob = launch { while (true) { val str = socket.receiveOrNull() ?: break - val data = kotlin.js.JSON.parse<dynamic>(str).result + val data = kotlin.js.JSON.parse<JsonRpcResponse>(str).result ?: "" val par2 = try { deserializeList<PAR2>(data, PAR2::class.js.name) } catch (t: NotStandardTypeException) { diff --git a/kvision-modules/kvision-remote/src/main/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt b/kvision-modules/kvision-remote/src/main/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt index 0cf72f76..7db690b2 100644 --- a/kvision-modules/kvision-remote/src/main/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt +++ b/kvision-modules/kvision-remote/src/main/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt @@ -149,7 +149,7 @@ actual open class KVServiceManager<T : Any> actual constructor(serviceClass: KCl route: String? ) { val routeDef = "route${this::class.simpleName}${counter++}" - calls[function.toString().replace("\\s".toRegex(), "")] = Pair("/kv/$routeDef", HttpMethod.POST) + calls[function.toString().replace("\\s".toRegex(), "")] = Pair("/kvws/$routeDef", HttpMethod.POST) } /** |