Add action to the character sheet detail panel.
This commit is contained in:
parent
b6d02c21be
commit
1fe75062b7
14 changed files with 469 additions and 56 deletions
|
|
@ -17,6 +17,7 @@ dependencies {
|
|||
implementation(projects.shared)
|
||||
implementation(libs.logback)
|
||||
implementation(libs.koin.ktor)
|
||||
implementation(libs.kotlinx.serialization.json)
|
||||
implementation(libs.ktor.server.core)
|
||||
implementation(libs.ktor.server.netty)
|
||||
implementation(libs.ktor.server.websockets)
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import com.pixelized.shared.lwa.protocol.websocket.Message
|
|||
import io.ktor.websocket.Frame
|
||||
import io.ktor.websocket.readText
|
||||
import kotlinx.serialization.json.Json
|
||||
import kotlinx.serialization.json.encodeToJsonElement
|
||||
|
||||
|
||||
fun Json.decodeFromFrame(frame: Frame.Text): Message {
|
||||
val json = frame.readText()
|
||||
|
|
@ -12,6 +12,6 @@ fun Json.decodeFromFrame(frame: Frame.Text): Message {
|
|||
}
|
||||
|
||||
fun Json.encodeToFrame(message: Message): Frame {
|
||||
val json = encodeToJsonElement(message)
|
||||
return Frame.Text(text = json.toString())
|
||||
val json = encodeToString(message)
|
||||
return Frame.Text(text = json)
|
||||
}
|
||||
|
|
@ -81,7 +81,8 @@ class LocalServer {
|
|||
val job = launch {
|
||||
// send local message to the clients
|
||||
engine.webSocket.collect { message ->
|
||||
send(json.encodeToFrame(message))
|
||||
val frame = json.encodeToFrame(message)
|
||||
send(frame)
|
||||
}
|
||||
}
|
||||
runCatching {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue