Skip to content

Commit af94b00

Browse files
authored
upgrade deps (#17)
* upgrade deps * fix ut * kotlinUpgradeYarnLock * fix js test local run
1 parent 8a97744 commit af94b00

File tree

10 files changed

+36
-31
lines changed

10 files changed

+36
-31
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
object Consts {
22
const val releaseGroup = "com.piasy"
33
const val releaseName = "kmp-socketio"
4-
const val releaseVersion = "1.3.1"
4+
const val releaseVersion = "1.3.2"
55

66
val androidNS = "$releaseGroup.${releaseName.replace('-', '.')}"
77
}

gradle/libs.versions.toml

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,21 @@ compileSdk = "35"
55
minSdk = "21"
66
targetSdk = "35"
77
agp = "8.7.3"
8-
kotlin = "2.1.10"
9-
mockk = "1.13.16"
8+
kotlin = "2.2.0"
109
ktor = "3.2.2"
11-
coroutine = "1.10.1"
12-
compose = "1.7.8"
10+
coroutine = "1.10.2"
11+
compose = "1.8.3"
1312

1413
[libraries]
1514
junit = "junit:junit:4.13.2"
1615
hamcrest = "org.hamcrest:hamcrest-library:3.0"
1716
kotlin-test = { module = "org.jetbrains.kotlin:kotlin-test", version.ref = "kotlin" }
18-
mockk = { module = "io.mockk:mockk", version.ref = "mockk" }
17+
mockk = "io.mockk:mockk:1.14.4"
1918
kotlinx-coroutines-test = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-test", version.ref = "coroutine" }
2019
json = "org.json:json:20250107"
2120
kommand = "com.kgit2:kommand:2.3.0"
2221

23-
socketioParser = "org.hildan.socketio:socketio-kotlin:2.0.0"
22+
socketioParser = "org.hildan.socketio:socketio-kotlin:2.6.0"
2423
kotlinx-coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "coroutine" }
2524
ktor-client-core = { module = "io.ktor:ktor-client-core", version.ref = "ktor" }
2625
ktor-client-websockets = { module = "io.ktor:ktor-client-websockets", version.ref = "ktor" }
@@ -48,7 +47,7 @@ android-application = { id = "com.android.application", version.ref = "agp" }
4847
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
4948
compose-compiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" }
5049
kmp = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" }
51-
versions = "com.github.ben-manes.versions:0.51.0"
52-
versionUpdate = "nl.littlerobots.version-catalog-update:0.8.5"
50+
versions = "com.github.ben-manes.versions:0.52.0"
51+
versionUpdate = "nl.littlerobots.version-catalog-update:1.0.0"
5352
vanniktech-mavenPublish = "com.vanniktech.maven.publish:0.30.0"
5453
kover = "org.jetbrains.kotlinx.kover:0.9.1"

kmp-socketio/build.gradle.kts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,7 @@ version = Consts.releaseVersion
1010
group = Consts.releaseGroup
1111

1212
kotlin {
13-
jvm {
14-
withJava()
15-
}
13+
jvm()
1614

1715
iosArm64()
1816
iosSimulatorArm64()
@@ -26,8 +24,8 @@ kotlin {
2624
binaries.executable()
2725
}
2826

29-
mingwX64 {}
30-
linuxX64 {}
27+
mingwX64()
28+
linuxX64()
3129

3230
applyDefaultHierarchyTemplate()
3331
sourceSets {

kmp-socketio/src/commonMain/kotlin/com/piasy/kmp/socketio/engineio/transports/WebSocket.kt

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ open class WebSocket(
2525
private val factory: HttpClientFactory = DefaultHttpClientFactory(trustAllCerts = opt.trustAllCerts),
2626
rawMessage: Boolean,
2727
) : Transport(opt, scope, NAME, rawMessage) {
28-
private var ws: DefaultClientWebSocketSession? = null
28+
private var ws: WebSocketSession? = null
2929

3030
@WorkThread
3131
override fun pause(onPause: () -> Unit) {
@@ -49,10 +49,12 @@ open class WebSocket(
4949
}
5050
}) {
5151
ws = this
52-
val respHeaders = call.response.headers.toMap()
53-
scope.launch {
54-
emit(EVENT_RESPONSE_HEADERS, respHeaders)
55-
onOpen()
52+
if (this is DefaultClientWebSocketSession) {
53+
val respHeaders = call.response.headers.toMap()
54+
scope.launch {
55+
emit(EVENT_RESPONSE_HEADERS, respHeaders)
56+
onOpen()
57+
}
5658
}
5759

5860
listen()

kmp-socketio/src/commonMain/kotlin/com/piasy/kmp/socketio/engineio/transports/transport.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
package com.piasy.kmp.socketio.engineio.transports
22

33
import com.piasy.kmp.socketio.engineio.Transport
4-
import com.piasy.kmp.xlog.Platform
54
import io.ktor.client.HttpClientConfig
65
import io.ktor.client.HttpClient
76
import io.ktor.client.plugins.logging.*
87
import io.ktor.client.plugins.websocket.*
98
import io.ktor.client.request.*
109
import io.ktor.client.statement.*
1110
import io.ktor.http.*
11+
import io.ktor.websocket.WebSocketSession
1212
import kotlinx.coroutines.CoroutineScope
1313

1414
expect fun httpClient(trustAllCerts: Boolean = false, config: HttpClientConfig<*>.() -> Unit = {}): HttpClient
@@ -50,7 +50,7 @@ interface HttpClientFactory {
5050
suspend fun createWs(
5151
url: String,
5252
request: HttpRequestBuilder.() -> Unit,
53-
block: suspend DefaultClientWebSocketSession.() -> Unit,
53+
block: suspend WebSocketSession.() -> Unit,
5454
)
5555

5656
suspend fun httpRequest(
@@ -85,7 +85,7 @@ class DefaultHttpClientFactory(
8585
override suspend fun createWs(
8686
url: String,
8787
request: HttpRequestBuilder.() -> Unit,
88-
block: suspend DefaultClientWebSocketSession.() -> Unit,
88+
block: suspend WebSocketSession.() -> Unit,
8989
) = wsClient.webSocket(url, request, block)
9090

9191
override suspend fun httpRequest(

kmp-socketio/src/commonTest/kotlin/com/piasy/kmp/socketio/socketio/ConnectionTest.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ abstract class ConnectionTest {
8383
)
8484
val responseResult = runCatching {
8585
trustAllCertsHttpClientFactory.httpRequest(
86-
url = "https://expired.badssl.com/",
86+
url = "https://localhost:8443/",
8787
) {}
8888
}
8989
assertTrue(responseResult.isSuccess)
@@ -97,7 +97,7 @@ abstract class ConnectionTest {
9797
)
9898
val responseResult = runCatching {
9999
trustAllCertsHttpClientFactory.httpRequest(
100-
url = "https://expired.badssl.com/",
100+
url = "https://localhost:8443/",
101101
) {}
102102
}
103103
assertTrue(responseResult.isFailure)

kmp-socketio/src/jvmTest/java/io/socket/client/ConnectionTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -449,7 +449,7 @@ public void call(Object... args) {
449449
assertThat((Integer)values.take(), is(2));
450450
}
451451

452-
@Test(timeout = TIMEOUT)
452+
@Test(timeout = TIMEOUT * 2)
453453
public void reconnectDelayShouldIncreaseEveryTime() throws InterruptedException {
454454
final BlockingQueue<Object> values = new LinkedBlockingQueue<>();
455455
IO.Options opts = createOptions();

kmp-socketio/src/jvmTest/kotlin/com/piasy/kmp/socketio/engineio/transports/WebSocketTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class WebSocketTest : BaseTest() {
3333

3434
val factory = mockk<HttpClientFactory>()
3535
val requestBuilder = slot<HttpRequestBuilder.() -> Unit>()
36-
val block = slot<suspend DefaultClientWebSocketSession.() -> Unit>()
36+
val block = slot<suspend WebSocketSession.() -> Unit>()
3737
coEvery { factory.createWs(any(), capture(requestBuilder), capture(block)) } coAnswers {
3838
requestBuilder.captured(HttpRequestBuilder())
3939
block.captured(ws)

kmp-socketio/src/jvmTest/resources/socket-server.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,3 +146,14 @@ before(io.engine, 'handleUpgrade', function(req, socket, head) {
146146
server.listen(port, function() {
147147
console.log('Socket.IO server listening on port', port);
148148
});
149+
150+
https_server = require('https').createServer({
151+
key: fs.readFileSync(__dirname + '/key.pem'),
152+
cert: fs.readFileSync(__dirname + '/cert.pem')
153+
}, (req, res) => {
154+
console.log('got https req');
155+
res.end('self signed https server');
156+
});
157+
https_server.listen(8443, function() {
158+
console.log('https server listening on port 8443');
159+
});

kotlin-js-store/yarn.lock

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2488,11 +2488,6 @@ type-is@~1.6.18:
24882488
media-typer "0.3.0"
24892489
mime-types "~2.1.24"
24902490

2491-
2492-
version "5.5.4"
2493-
resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.5.4.tgz#d9852d6c82bad2d2eda4fd74a5762a8f5909e9ba"
2494-
integrity sha512-Mtq29sKDAEYP7aljRgtPOpTvOfbwRWlS6dPRzwjdE+C0R4brX/GUyhHSecbHMFLNBLcJIPt9nl9yG5TZ1weH+Q==
2495-
24962491
ua-parser-js@^0.7.30:
24972492
version "0.7.32"
24982493
resolved "https://registry.yarnpkg.com/ua-parser-js/-/ua-parser-js-0.7.32.tgz#cd8c639cdca949e30fa68c44b7813ef13e36d211"

0 commit comments

Comments
 (0)