0.7.1-SNAPSHOT: small improvements to make it more universal and easy to use

This commit is contained in:
Sergey Chernov 2026-05-31 00:12:35 +03:00
parent 2829bcfecd
commit 7bebbf7bd7
5 changed files with 14 additions and 8 deletions

1
.gitignore vendored
View File

@ -46,3 +46,4 @@ out/
/.idea/workspace.xml
/.gigaide/gigaide.properties
local.properties
/kotlin-js-store/yarn.lock

1
.idea/misc.xml generated
View File

@ -1,4 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="FrameworkDetectionExcludesConfiguration">

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2025. Sergey S. Chernov - All Rights Reserved
* Copyright (c) 2025-2026. Sergey S. Chernov - All Rights Reserved
*
* You may use, distribute and modify this code under the
* terms of the private license, which you must obtain from the author
@ -19,7 +19,7 @@ plugins {
}
group = "net.sergeych"
version = "0.7.0-SNAPSHOT"
version = "0.7.1-SNAPSHOT"
repositories {
mavenCentral()
@ -98,6 +98,7 @@ kotlin {
implementation("io.ktor:ktor-server-core:$ktor_version")
implementation("io.ktor:ktor-server-core-jvm:$ktor_version")
implementation("io.ktor:ktor-server-websockets-jvm:$ktor_version")
implementation("io.ktor:ktor-server-websockets:${ktor_version}")
implementation("io.ktor:ktor-server-netty:$ktor_version")
api("io.ktor:ktor-client-cio:$ktor_version")
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2025. Sergey S. Chernov - All Rights Reserved
* Copyright (c) 2025-2026. Sergey S. Chernov - All Rights Reserved
*
* You may use, distribute and modify this code under the
* terms of the private license, which you must obtain from the author
@ -14,7 +14,6 @@ import kotlinx.coroutines.CancellationException
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.launch
import net.sergeych.crypto2.SigningKey
import net.sergeych.kiloparsec.adapter.InetTransportDevice
import net.sergeych.mp_logger.LogTag
import net.sergeych.mp_logger.debug
import net.sergeych.mp_logger.exception
@ -113,7 +112,7 @@ private val instances = AtomicCounter()
*/
class KiloServer<S>(
private val clientInterface: KiloInterface<S>,
private val connections: Flow<InetTransportDevice>,
private val connections: Flow<Transport.Device>,
private val serverSecretKey: SigningKey? = null,
private val sessionBuilder: () -> S,
) : LogTag("KS:${instances.incrementAndGet()}") {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2025. Sergey S. Chernov - All Rights Reserved
* Copyright (c) 2025-2026. Sergey S. Chernov - All Rights Reserved
*
* You may use, distribute and modify this code under the
* terms of the private license, which you must obtain from the author
@ -62,11 +62,17 @@ fun websocketTransportDevice(
install(WebSockets)
},
): Transport.Device {
val log = LogTag("WSTD")
var u = Url(path)
if (u.encodedPath.length <= 1)
log.debug { "Creating websocket transport device at $u" }
if (u.encodedPath.length <= 1) {
log.debug {"Correcting path as up = ${u.encodedPath}" }
u = URLBuilder(u).apply {
encodedPath = "/kp"
}.build()
}
log.debug { "Url to process is $u" }
val input = Channel<UByteArray>()
val output = Channel<UByteArray>()