diff options
author | Robert Jaros <rjaros@finn.pl> | 2019-03-31 00:06:25 +0100 |
---|---|---|
committer | Robert Jaros <rjaros@finn.pl> | 2019-03-31 00:06:25 +0100 |
commit | f1f0423f63cc9f39fa74fc9b68bb680f1d1abd31 (patch) | |
tree | dc083b68749b09d7d8c0ed4bfa90262feac83624 /kvision-modules/kvision-common-remote | |
parent | 967f6278ded0d540ce3d7613bd0d39338ef14d63 (diff) | |
download | kvision-f1f0423f63cc9f39fa74fc9b68bb680f1d1abd31.tar.gz kvision-f1f0423f63cc9f39fa74fc9b68bb680f1d1abd31.tar.bz2 kvision-f1f0423f63cc9f39fa74fc9b68bb680f1d1abd31.zip |
Websockets implementation
Diffstat (limited to 'kvision-modules/kvision-common-remote')
-rw-r--r-- | kvision-modules/kvision-common-remote/src/main/kotlin/pl/treksoft/kvision/remote/KVServiceManager.kt | 11 |
1 files changed, 11 insertions, 0 deletions
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<T : Any>(serviceClass: KClass<T>) { protected fun bind( function: T.(String?, String?) -> List<RemoteSelectOption> ) + + /** + * Binds a given function of the receiver as a web socket connection + * @param function a function of the receiver + */ + protected inline fun <reified PAR1 : Any, reified PAR2 : Any> bind( + noinline function: suspend T.(ReceiveChannel<PAR1>, SendChannel<PAR2>) -> Unit, + route: String? = null + ) } |