Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
cov: on
cmd: "./gradlew :kmp-socketio:jvmTest --info"
- os: macos-latest
cmd: "./gradlew :kmp-socketio:macosX64Test --info && ./kmp-socketio/src/jsTest/start_server.sh && ./gradlew :kmp-socketio:jsBrowserTest --info && ./kmp-socketio/src/jsTest/stop_server.sh"
cmd: "./gradlew :kmp-socketio:macosX64Test --info && ./kmp-socketio/src/webTest/start_server.sh && ./gradlew :kmp-socketio:jsBrowserTest --info && ./gradlew :kmp-socketio:wasmJsBrowserTest --info && ./kmp-socketio/src/webTest/stop_server.sh"
- os: ubuntu-latest
cmd: "./gradlew :kmp-socketio:linuxX64Test --info"
- os: windows-latest
Expand Down
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,15 @@ pod install
Use Chrome CORS Unblock extension to workaround with CORS error.

```bash
./gradlew :example:shared:jsBrowserRun
./gradlew :example:shared:jsBrowserDevelopmentRun
```

### WasmJS

Use Chrome CORS Unblock extension to workaround with CORS error.

```bash
./gradlew :example:shared:wasmJsBrowserDevelopmentRun
```

### Windows
Expand Down
2 changes: 1 addition & 1 deletion buildSrc/src/main/kotlin/Constants.kt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
object Consts {
const val releaseGroup = "com.piasy"
const val releaseName = "kmp-socketio"
const val releaseVersion = "1.3.3"
const val releaseVersion = "1.4.0"

val androidNS = "$releaseGroup.${releaseName.replace('-', '.')}"
}
21 changes: 17 additions & 4 deletions example/shared/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import org.jetbrains.kotlin.gradle.targets.js.webpack.KotlinWebpackConfig
@file:OptIn(ExperimentalWasmDsl::class)

import org.jetbrains.kotlin.gradle.ExperimentalWasmDsl

plugins {
alias(libs.plugins.kmp)
Expand Down Expand Up @@ -34,11 +36,22 @@ kotlin {
}
}

js(IR) {
browser {
}
js {
browser()
nodejs()
binaries.executable()
}
wasmJs {
browser()
nodejs()
d8()
binaries.executable()
}
// ktor doesn't support wasmWasi yet.
// wasmWasi {
// nodejs()
// binaries.executable()
// }

listOf(linuxX64(), mingwX64()).forEach {
it.binaries {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import kotlinx.io.bytestring.unsafe.UnsafeByteStringOperations
class Greeting {
@OptIn(UnsafeByteStringApi::class)
fun greet() {
IO.socket("http://172.16.11.25:3000", IO.Options()) { socket ->
IO.socket("http://172.16.11.186:3000", IO.Options()) { socket ->
socket.on(Socket.EVENT_CONNECT) { args ->
println("Greeting on connect ${args.joinToString()}")

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package com.piasy.kmp.socketio.example

fun main() {
Greeting().greet()
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
<title>kmp-xlog</title>
</head>
<body>
<h1 id="text"></h1>
<h1>kmp-socketio (check console log)</h1>
<h2>Use Chrome CORS Unblock extension to workaround with CORS error.</h2>
<script src="shared.js"></script>
</body>
</html>
24 changes: 12 additions & 12 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
[versions]
jvm = "17"
iosDeploymentTarget = "14.0"
compileSdk = "35"
compileSdk = "36"
minSdk = "21"
targetSdk = "35"
agp = "8.7.3"
kotlin = "2.2.0"
ktor = "3.2.2"
targetSdk = "36"
agp = "8.13.0"
kotlin = "2.2.20"
ktor = "3.3.0"
coroutine = "1.10.2"
compose = "1.8.3"
compose = "1.9.2"

[libraries]
junit = "junit:junit:4.13.2"
hamcrest = "org.hamcrest:hamcrest-library:3.0"
kotlin-test = { module = "org.jetbrains.kotlin:kotlin-test", version.ref = "kotlin" }
mockk = "io.mockk:mockk:1.14.4"
mockk = "io.mockk:mockk:1.14.5"
kotlinx-coroutines-test = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-test", version.ref = "coroutine" }
json = "org.json:json:20250107"
json = "org.json:json:20250517"
kommand = "com.kgit2:kommand:2.3.0"

socketioParser = "org.hildan.socketio:socketio-kotlin:2.6.0"
Expand All @@ -32,14 +32,14 @@ ktor-client-curl = { module = "io.ktor:ktor-client-curl", version.ref = "ktor" }
ktor-client-js = { module = "io.ktor:ktor-client-js", version.ref = "ktor" }
ktor-client-java = { module = "io.ktor:ktor-client-java", version.ref = "ktor" }
ktor-client-cio = { module = "io.ktor:ktor-client-cio", version.ref = "ktor" }
kmpXlog = "com.piasy:kmp-xlog-api:1.4.3"
kmpXlog = "com.piasy:kmp-xlog-api:1.5.0"

androidx-compose-ui = { module = "androidx.compose.ui:ui", version.ref = "compose" }
androidx-compose-ui-tooling = { module = "androidx.compose.ui:ui-tooling", version.ref = "compose" }
androidx-compose-ui-tooling-preview = { module = "androidx.compose.ui:ui-tooling-preview", version.ref = "compose" }
androidx-compose-foundation = { module = "androidx.compose.foundation:foundation", version.ref = "compose" }
androidx-compose-material = { module = "androidx.compose.material:material", version.ref = "compose" }
androidx-activity-compose = "androidx.activity:activity-compose:1.10.1"
androidx-activity-compose = "androidx.activity:activity-compose:1.11.0"

[plugins]
android-library = { id = "com.android.library", version.ref = "agp" }
Expand All @@ -49,5 +49,5 @@ compose-compiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "
kmp = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" }
versions = "com.github.ben-manes.versions:0.52.0"
versionUpdate = "nl.littlerobots.version-catalog-update:1.0.0"
vanniktech-mavenPublish = "com.vanniktech.maven.publish:0.30.0"
kover = "org.jetbrains.kotlinx.kover:0.9.1"
vanniktech-mavenPublish = "com.vanniktech.maven.publish:0.34.0"
kover = "org.jetbrains.kotlinx.kover:0.9.2"
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Wed Nov 16 22:27:43 CST 2022
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-9.1.0-all.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
22 changes: 16 additions & 6 deletions kmp-socketio/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import com.vanniktech.maven.publish.SonatypeHost
@file:OptIn(ExperimentalWasmDsl::class)

import org.jetbrains.kotlin.gradle.ExperimentalWasmDsl

plugins {
alias(libs.plugins.kmp)
Expand All @@ -18,11 +20,19 @@ kotlin {
macosArm64()
macosX64()

js(IR) {
browser {
}
binaries.executable()
js {
browser()
nodejs()
}
wasmJs {
browser()
nodejs()
d8()
}
// ktor doesn't support wasmWasi yet.
// wasmWasi {
// nodejs()
// }

mingwX64()
linuxX64()
Expand Down Expand Up @@ -108,7 +118,7 @@ kotlin {
}

mavenPublishing {
publishToMavenCentral(SonatypeHost.CENTRAL_PORTAL)
publishToMavenCentral()

signAllPublications()

Expand Down
8 changes: 8 additions & 0 deletions kotlin-js-store/wasm/yarn.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1


[email protected]:
version "8.18.3"
resolved "https://registry.yarnpkg.com/ws/-/ws-8.18.3.tgz#b56b88abffde62791c639170400c93dcb0c95472"
integrity sha512-PEIGCY5tSlUt50cqyMXfCzX+oOPqN0vuGqWzbcJ2xvnkzkq46oOpz7dQaTDBdfICb4N14+GARUDw2XV2N4tvzg==
Loading
Loading