From f2d318d639a02edba5cfec21c825ce4a949eb911 Mon Sep 17 00:00:00 2001 From: abdussamedulutas Date: Wed, 17 Jun 2026 13:25:06 +0300 Subject: [PATCH] =?UTF-8?q?fix:=20Connection.=5FonMessage=20ham=20string?= =?UTF-8?q?=20iletiyordu,=20codec.decode=20patl=C4=B1yordu?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit _onMessage JSON.parse yapıp obje iletiyordu → codec.decode 'unexpected frame type object' hatası fırlatıyordu → wsts/hello hiç işlenmiyordu → 5s timeout. Düzeltme: ham string/ArrayBuffer doğrudan callback'e geçiliyor, JSON parse işi codec.decode'a (WSTSProtocol.PackAnalyze) bırakılıyor. Co-Authored-By: Claude Sonnet 4.6 --- sdk/Connection.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/sdk/Connection.js b/sdk/Connection.js index 1557580..d3fbaca 100644 --- a/sdk/Connection.js +++ b/sdk/Connection.js @@ -80,11 +80,9 @@ export class Connection { } _onMessage(data) { - if (typeof data === 'string') { - const parsed = JSON.parse(data); - for (const cb of this._packCallbacks) cb(parsed); - } else if (data instanceof ArrayBuffer) { - // Binary frame — passed raw to WSTSProtocol for codec decoding. + // Pass raw wire data to WSTSProtocol; codec.decode() handles parsing. + // Pre-parsing here would hand an object to codec.decode which only accepts string/ArrayBuffer. + if (typeof data === 'string' || data instanceof ArrayBuffer) { for (const cb of this._packCallbacks) cb(data); } }