|
1 | 1 | window.lastLogLineCount = window.lastLogLineCount || {}; |
2 | 2 |
|
3 | | -// --- Raw WebSocket Message Log UI --- |
4 | | -$(document).ready(function () { |
5 | | - // Add a raw message log panel to the body |
6 | | - const rawLogPanel = $(` |
7 | | - <div id="rawMessageLogPanel" style="position:fixed;bottom:0;right:0;width:420px;height:200px;z-index:9999;background:rgba(20,20,20,0.97);color:#eee;font-family:monospace;font-size:12px;overflow:auto;border-top-left-radius:8px;border:1px solid #444;box-shadow:0 0 8px #000;"> |
8 | | - <div style="padding:2px 8px;background:#222;border-top-left-radius:8px;border-bottom:1px solid #444;display:flex;align-items:center;"> |
9 | | - <span style="flex:1;">Raw WebSocket Log</span> |
10 | | - <button id="clearRawLog" style="background:#444;color:#eee;border:none;border-radius:4px;padding:2px 8px;cursor:pointer;">Clear</button> |
11 | | - </div> |
12 | | - <div id="rawMessageLog" style="height:170px;overflow:auto;padding:4px;"></div> |
13 | | - </div> |
14 | | - `); |
15 | | - $("body").append(rawLogPanel); |
16 | | - $("#clearRawLog").click(function () { |
17 | | - $("#rawMessageLog").empty(); |
18 | | - }); |
19 | | -}); |
20 | | - |
21 | 3 | function closeMenu() { |
22 | 4 | $("#menu").animate( |
23 | 5 | { |
@@ -582,26 +564,6 @@ $(document).ready(function () { |
582 | 564 | }); |
583 | 565 |
|
584 | 566 | socket.onmessage = function (message) { |
585 | | - // Log the raw message for debugging |
586 | | - if (typeof message.data === "string") { |
587 | | - console.log("[WS RAW] (text):", message.data); |
588 | | - } else if (message.data instanceof ArrayBuffer) { |
589 | | - // Show as hex and as decoded MessagePack (if possible) |
590 | | - const arr = new Uint8Array(message.data); |
591 | | - const hex = Array.from(arr) |
592 | | - .map((b) => b.toString(16).padStart(2, "0")) |
593 | | - .join(" "); |
594 | | - console.log("[WS RAW] (binary, hex):", hex); |
595 | | - try { |
596 | | - const decoded = window.MessagePack.decode(arr); |
597 | | - console.log("[WS RAW] (MessagePack decoded):", decoded); |
598 | | - } catch (e) { |
599 | | - console.log("[WS RAW] (MessagePack decode error):", e); |
600 | | - } |
601 | | - } else { |
602 | | - console.log("[WS RAW] (unknown type):", message.data); |
603 | | - } |
604 | | - |
605 | 567 | let obj; |
606 | 568 | if (typeof message.data === "string") { |
607 | 569 | obj = JSON.parse(message.data); |
|
0 commit comments