[TSM.ID].[11031972] PXE : Platform X Ecosystem I [118 Module -LIVE-]

This commit is contained in:
TSM.ID
2026-05-25 03:50:05 +07:00
commit e820143b3c
673 changed files with 101320 additions and 0 deletions
+76
View File
@@ -0,0 +1,76 @@
<!DOCTYPE html>
<html>
<head><title>WS Debug</title></head>
<body>
<h2>XCU WebSocket Debug</h2>
<div id="log" style="font-family:monospace;white-space:pre;font-size:12px;max-height:80vh;overflow:auto;background:#111;color:#0f0;padding:10px;"></div>
<script>
const log = (msg) => {
const el = document.getElementById('log');
const time = new Date().toISOString().substr(11,12);
el.textContent += `[${time}] ${msg}\n`;
el.scrollTop = el.scrollHeight;
};
const roomName = 'JMP-C9DF-40CD';
const wsUrl = `wss://${window.location.host}/ws/${roomName}`;
log(`Connecting to: ${wsUrl}`);
const ws = new WebSocket(wsUrl);
ws.binaryType = 'arraybuffer';
const myId = Math.floor(Math.random() * 65534) + 1;
log(`My participant ID: ${myId}`);
ws.onopen = () => {
log('WebSocket OPEN');
// Send heartbeat every 2s
setInterval(() => {
if (ws.readyState === WebSocket.OPEN) {
const hb = new Uint8Array(8);
hb[0] = 5; // heartbeat
const v = new DataView(hb.buffer);
v.setUint16(2, myId, true);
v.setUint32(4, 0, true);
ws.send(hb);
}
}, 2000);
};
ws.onerror = (e) => log(`WebSocket ERROR: ${JSON.stringify(e)}`);
ws.onclose = (e) => log(`WebSocket CLOSED: code=${e.code} reason=${e.reason}`);
let frameCount = 0;
let myFrames = 0;
let otherFrames = 0;
const senders = new Set();
ws.onmessage = (event) => {
if (event.data instanceof ArrayBuffer) {
const arr = new Uint8Array(event.data);
if (arr.length >= 8) {
const type = arr[0];
const quality = arr[1];
const dv = new DataView(event.data);
const senderId = dv.getUint16(2, true);
const payloadLen = dv.getUint32(4, true);
if (senderId === myId) {
myFrames++;
} else {
otherFrames++;
senders.add(senderId);
}
frameCount++;
if (frameCount % 30 === 0 || type === 5 || otherFrames <= 3) {
log(`FRAME #${frameCount} | type=${type} quality=${quality} sender=${senderId} payloadLen=${payloadLen} totalBytes=${arr.length} | MY=${myFrames} OTHER=${otherFrames} senders=[${[...senders].join(',')}]`);
}
}
} else {
log(`TEXT: ${event.data}`);
}
};
</script>
</body>
</html>