fix: Connection._onMessage ham string iletiyordu, codec.decode patlıyordu

_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 <noreply@anthropic.com>
This commit is contained in:
abdussamedulutas 2026-06-17 13:25:06 +03:00
parent 66158b1f74
commit f2d318d639
1 changed files with 3 additions and 5 deletions

View File

@ -80,11 +80,9 @@ export class Connection {
} }
_onMessage(data) { _onMessage(data) {
if (typeof data === 'string') { // Pass raw wire data to WSTSProtocol; codec.decode() handles parsing.
const parsed = JSON.parse(data); // Pre-parsing here would hand an object to codec.decode which only accepts string/ArrayBuffer.
for (const cb of this._packCallbacks) cb(parsed); if (typeof data === 'string' || data instanceof ArrayBuffer) {
} else if (data instanceof ArrayBuffer) {
// Binary frame — passed raw to WSTSProtocol for codec decoding.
for (const cb of this._packCallbacks) cb(data); for (const cb of this._packCallbacks) cb(data);
} }
} }