From 45eb5dfaea0b613744c0f7e41c29aab23ca6038d Mon Sep 17 00:00:00 2001 From: Bruno Deanoz Date: Wed, 24 Jun 2026 13:00:42 +0200 Subject: [PATCH] fix Live Call: include type field in WS protocol messages MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit encodeDefaults=false caused kotlinx.serialization to skip the type="setup" field since it was a default value. The server's parseClientMessage needs the type field to dispatch — without it every setup message was rejected as "malformed_message". Changed to encodeDefaults=true + explicitNulls=false so type is always serialized but null optionals are still omitted. --- app/src/main/java/dev/kaizen/app/live/LiveProtocol.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/dev/kaizen/app/live/LiveProtocol.kt b/app/src/main/java/dev/kaizen/app/live/LiveProtocol.kt index 4242f4e..9f6fa89 100644 --- a/app/src/main/java/dev/kaizen/app/live/LiveProtocol.kt +++ b/app/src/main/java/dev/kaizen/app/live/LiveProtocol.kt @@ -14,7 +14,7 @@ import kotlinx.serialization.json.jsonPrimitive import kotlinx.serialization.json.long import kotlinx.serialization.json.longOrNull -private val json = Json { ignoreUnknownKeys = true; encodeDefaults = false } +private val json = Json { ignoreUnknownKeys = true; encodeDefaults = true; explicitNulls = false } // ─── Client → Server ──────────────────────────────────────────────────────