Fix: relay WebSocket messages as text frames (browsers got Blobs they could not parse)

Root cause of 'track does not start': the server re-broadcast incoming frames as
binary (Buffer), so the browser output page received Blobs, JSON.parse failed,
and every command (playTrack, etc.) was silently dropped — only the text-encoded
lastEffect sync got through. Broadcast as text now; net.js also handles Blob
defensively. Also: no-store for app assets + kiosk --disk-cache-size=1 so
redeploys always take effect; /api/clients debug endpoint; /api/peaks duration.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
lucianoandClaude Opus 4.8 committed 2026-06-29 14:58:33 +02:00
1 parent c0230ee1d6
commit 1a66a46b1f
4 files changed
+22 -4

No files matched your search

+7 -2
View File
@@ -14,11 +14,16 @@
ws.onopen = () => { ready = true; setStatus(true); while (queue.length) ws.send(queue.shift()); };
ws.onclose = () => { ready = false; setStatus(false); setTimeout(connect, 1000); }; // survive server restarts
ws.onerror = () => { try { ws.close(); } catch (e) {} };
ws.onmessage = (ev) => {
let m; try { m = JSON.parse(ev.data); } catch (e) { return; }
const handle = (txt) => {
let m; try { m = JSON.parse(txt); } catch (e) { return; }
if (m.ch === 'ctl') ctlCbs.forEach(cb => cb(m.msg));
else if (m.ch === 'rpt') rptCbs.forEach(cb => cb(m.msg));
};
ws.onmessage = (ev) => {
if (typeof ev.data === 'string') handle(ev.data);
else if (ev.data && typeof ev.data.text === 'function') ev.data.text().then(handle); // Blob
else handle(String(ev.data));
};
}
connect();
+3
View File
@@ -341,6 +341,9 @@ djv.onControl(async (m) => {
djv.report({ type: 'playState', playing: true });
} catch (e) { djv.report({ type: 'error', message: e.message }); }
break;
case 'diag':
djv.report({ type: 'diag', stage: 'poll', ctx: audio.ctx.state, mode: audio.mode });
break;
case 'playVideoTrack':
try {
audio.setTrim(m.start || 0, m.end || 0);