diff --git a/controls-core/build.gradle.kts b/controls-core/build.gradle.kts
index 2510957..777cb1e 100644
--- a/controls-core/build.gradle.kts
+++ b/controls-core/build.gradle.kts
@@ -1,5 +1,6 @@
plugins {
id("ru.mipt.npm.gradle.mpp")
+ id("ru.mipt.npm.gradle.native")
`maven-publish`
}
diff --git a/demo/src/main/kotlin/ru/mipt/npm/controls/demo/demoDeviceServer.kt b/demo/src/main/kotlin/ru/mipt/npm/controls/demo/demoDeviceServer.kt
index 9cf7589..0794f03 100644
--- a/demo/src/main/kotlin/ru/mipt/npm/controls/demo/demoDeviceServer.kt
+++ b/demo/src/main/kotlin/ru/mipt/npm/controls/demo/demoDeviceServer.kt
@@ -67,7 +67,7 @@ suspend fun MagixEndpoint.startDemoDeviceServer(): ApplicationEngine = embeddedS
val cosFlow = MutableSharedFlow()// = device.cos.flow()
launch {
- subscribe(controlsMagixFormat).collect { (magix, payload) ->
+ subscribe(controlsMagixFormat).collect { (_, payload) ->
(payload as? PropertyChangedMessage)?.let { message ->
when (message.property) {
"sin" -> sinFlow.emit(message.value)
diff --git a/magix/magix-java-client/src/main/java/ru/mipt/npm/magix/client/MagixClient.java b/magix/magix-java-client/src/main/java/ru/mipt/npm/magix/client/MagixClient.java
index 58af6d2..3da2364 100644
--- a/magix/magix-java-client/src/main/java/ru/mipt/npm/magix/client/MagixClient.java
+++ b/magix/magix-java-client/src/main/java/ru/mipt/npm/magix/client/MagixClient.java
@@ -30,9 +30,9 @@ public interface MagixClient {
*
* @param host host name of magix server event loop
* @param port port of magix server event loop
- * @param path
+ * @param path context path for WS connection
*/
static MagixClient rSocketWs(String host, int port, String path) {
- return ControlsMagixClient.Companion.rSocketWs(host, port, JsonElement.Companion.serializer(), path);
+ return ControlsMagixClient.Companion.rSocketWs(host, port, path);
}
}
diff --git a/magix/magix-java-client/src/main/kotlin/ru/mipt/npm/magix/client/ControlsMagixClient.kt b/magix/magix-java-client/src/main/kotlin/ru/mipt/npm/magix/client/ControlsMagixClient.kt
index 11c2681..4abb15f 100644
--- a/magix/magix-java-client/src/main/kotlin/ru/mipt/npm/magix/client/ControlsMagixClient.kt
+++ b/magix/magix-java-client/src/main/kotlin/ru/mipt/npm/magix/client/ControlsMagixClient.kt
@@ -2,7 +2,6 @@ package ru.mipt.npm.magix.client
import kotlinx.coroutines.jdk9.asPublisher
import kotlinx.coroutines.runBlocking
-import kotlinx.serialization.KSerializer
import ru.mipt.npm.magix.api.MagixEndpoint
import ru.mipt.npm.magix.api.MagixMessage
import ru.mipt.npm.magix.api.MagixMessageFilter
@@ -36,7 +35,6 @@ internal class ControlsMagixClient(
fun rSocketWs(
host: String,
port: Int,
- payloadSerializer: KSerializer,
path: String = "/rsocket"
): ControlsMagixClient {
val endpoint = runBlocking {
diff --git a/magix/magix-rsocket/build.gradle.kts b/magix/magix-rsocket/build.gradle.kts
index 3d445a0..b5c1eb8 100644
--- a/magix/magix-rsocket/build.gradle.kts
+++ b/magix/magix-rsocket/build.gradle.kts
@@ -26,9 +26,13 @@ kotlin {
implementation("io.rsocket.kotlin:rsocket-ktor-client:$rsocketVersion")
}
}
- jvmMain{
- dependencies{
- implementation("io.ktor:ktor-network:$ktorVersion")
+ jvmMain {
+ dependencies {
+ implementation("io.rsocket.kotlin:rsocket-transport-ktor-tcp:$rsocketVersion")
+ }
+ }
+ linuxX64Main{
+ dependencies {
implementation("io.rsocket.kotlin:rsocket-transport-ktor-tcp:$rsocketVersion")
}
}
diff --git a/magix/magix-rsocket/src/jvmMain/kotlin/ru/mipt/npm/magix/rsocket/withTcp.kt b/magix/magix-rsocket/src/jvmMain/kotlin/ru/mipt/npm/magix/rsocket/withTcp.kt
index 05a596b..b42ee4f 100644
--- a/magix/magix-rsocket/src/jvmMain/kotlin/ru/mipt/npm/magix/rsocket/withTcp.kt
+++ b/magix/magix-rsocket/src/jvmMain/kotlin/ru/mipt/npm/magix/rsocket/withTcp.kt
@@ -1,7 +1,6 @@
package ru.mipt.npm.magix.rsocket
import io.ktor.network.sockets.SocketOptions
-import io.ktor.util.InternalAPI
import io.rsocket.kotlin.core.RSocketConnectorBuilder
import io.rsocket.kotlin.transport.ktor.tcp.TcpClientTransport
import ru.mipt.npm.magix.api.MagixEndpoint
@@ -11,7 +10,6 @@ import kotlin.coroutines.coroutineContext
/**
* Create a plain TCP based [RSocketMagixEndpoint] connected to [host] and [port]
*/
-@OptIn(InternalAPI::class)
public suspend fun MagixEndpoint.Companion.rSocketWithTcp(
host: String,
port: Int = DEFAULT_MAGIX_RAW_PORT,
diff --git a/magix/magix-rsocket/src/linuxX64Main/kotlin/rsocket/withTcp.kt b/magix/magix-rsocket/src/linuxX64Main/kotlin/rsocket/withTcp.kt
new file mode 100644
index 0000000..8e1d596
--- /dev/null
+++ b/magix/magix-rsocket/src/linuxX64Main/kotlin/rsocket/withTcp.kt
@@ -0,0 +1,29 @@
+package rsocket
+
+import io.ktor.network.sockets.SocketOptions
+import io.rsocket.kotlin.core.RSocketConnectorBuilder
+import io.rsocket.kotlin.transport.ktor.tcp.TcpClientTransport
+import ru.mipt.npm.magix.api.MagixEndpoint
+import ru.mipt.npm.magix.rsocket.RSocketMagixEndpoint
+import ru.mipt.npm.magix.rsocket.buildConnector
+import kotlin.coroutines.coroutineContext
+
+
+/**
+ * Create a plain TCP based [RSocketMagixEndpoint] connected to [host] and [port]
+ */
+public suspend fun MagixEndpoint.Companion.rSocketWithTcp(
+ host: String,
+ port: Int = DEFAULT_MAGIX_RAW_PORT,
+ tcpConfig: SocketOptions.TCPClientSocketOptions.() -> Unit = {},
+ rSocketConfig: RSocketConnectorBuilder.ConnectionConfigBuilder.() -> Unit = {},
+): RSocketMagixEndpoint {
+ val transport = TcpClientTransport(
+ hostname = host,
+ port = port,
+ configure = tcpConfig
+ )
+ val rSocket = buildConnector(rSocketConfig).connect(transport)
+
+ return RSocketMagixEndpoint(rSocket, coroutineContext)
+}
diff --git a/magix/magix-server/build.gradle.kts b/magix/magix-server/build.gradle.kts
index 5215f19..f73528d 100644
--- a/magix/magix-server/build.gradle.kts
+++ b/magix/magix-server/build.gradle.kts
@@ -19,7 +19,7 @@ val rsocketVersion: String by rootProject.extra
val ktorVersion: String = ru.mipt.npm.gradle.KScienceVersions.ktorVersion
dependencies{
- api(project(":magix:magix-api"))
+ api(projects.magix.magixApi)
api("io.ktor:ktor-server-cio:$ktorVersion")
api("io.ktor:ktor-server-websockets:$ktorVersion")
api("io.ktor:ktor-server-content-negotiation:$ktorVersion")