From f1f0423f63cc9f39fa74fc9b68bb680f1d1abd31 Mon Sep 17 00:00:00 2001 From: Robert Jaros Date: Sun, 31 Mar 2019 00:06:25 +0100 Subject: Websockets implementation --- .../kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'kvision-modules/kvision-common-remote/src/main/kotlin') diff --git a/kvision-modules/kvision-common-remote/src/main/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt b/kvision-modules/kvision-common-remote/src/main/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt index 514fb07d..e89744f6 100644 --- a/kvision-modules/kvision-common-remote/src/main/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt +++ b/kvision-modules/kvision-common-remote/src/main/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt @@ -21,6 +21,8 @@ */ package pl.treksoft.kvision.remote +import kotlinx.coroutines.channels.ReceiveChannel +import kotlinx.coroutines.channels.SendChannel import kotlin.reflect.KClass enum class HttpMethod { @@ -115,4 +117,13 @@ expect open class KVServiceManager(serviceClass: KClass) { protected fun bind( function: T.(String?, String?) -> List ) + + /** + * Binds a given function of the receiver as a web socket connection + * @param function a function of the receiver + */ + protected inline fun bind( + noinline function: suspend T.(ReceiveChannel, SendChannel) -> Unit, + route: String? = null + ) } -- cgit