Refactoring modules: Actor-2 removed

This commit is contained in:
Leonid Kaganov
2025-08-23 02:35:02 +03:00
parent e29ba95d50
commit 2774c0df63
8 changed files with 233 additions and 397 deletions
+13 -8
View File
@@ -63,7 +63,7 @@
<br />
<button onclick="sendMessage()">Send JSON</button>
<button onclick="clean()">❌clear</button>
<button onclick="pr('clear')">❌clear</button>
<p>
@@ -89,9 +89,15 @@
<div id="output">Waiting for server response...</div>
<script>
const output = document.getElementById("output");
const textarea = document.getElementById("jsonInput");
function pr(s) {
if(s=="clear") return output.textContent = "";
output.textContent = s+"\n\n"+output.textContent;
}
// const workspace="00000000-0000-0000-0000-000000000001";
let token="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhY2NvdW50IjoiYWFhYWFhYWEtYmJiYi1jY2NjLWRkZGQtZWVlZWVlZWVlZWVlIiwiZXh0cmEiOnsic2VydmljZSI6ImFjY291bnQifSwid29ya3NwYWNlIjoiMDAwMDAwMDAtMDAwMC0wMDAwLTAwMDAtMDAwMDAwMDAwMDAxIn0.ZrwMvv_0CjuKeF2CkmHyMK2vHd9Ro4M3kHZcZBrBxZQ";
@@ -101,15 +107,16 @@
ws.onopen = () => {
output.textContent = "✅ WebSocket connected.";
pr("clear");
pr("✅ WebSocket connected.");
};
ws.onmessage = (e) => {
output.textContent += "\n\n📥 From server:\n" + e.data;
pr(e.data);
};
ws.onerror = (e) => {
output.textContent += "\n\n❌ WebSocket error!";
pr("❌ WebSocket error!");
console.error(e);
};
@@ -119,17 +126,15 @@
try {
const parsed = JSON.parse(json); // validate JSON
ws.send(JSON.stringify(parsed));
output.textContent += "\n\n📤 Sent:\n" + JSON.stringify(parsed, null, 2);
pr("📤 Sent:\n" + JSON.stringify(parsed, null, 2));
} catch (e) {
output.textContent += "\n\n⚠️ Invalid JSON:\n" + e.message;
pr("\n\n⚠️ Invalid JSON:\n" + e.message);
}
}
function place(event) { textarea.value = (event || window.event).target.getAttribute("data"); sendMessage(); }
function clean() { output.textContent = ""; }
</script>
</body>