public/mindus.html

30 lines
754 B
HTML
Raw Normal View History

2024-05-22 11:03:59 +00:00
<!DOCTYPE html>
<html>
<head>
<title>ayo</title>
<meta charset="utf8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<h1>hello</h1>
<pre id="output"></pre>
<form id="form"><input id="input" /></form>
<script>
const form = document.getElementById("form");
const input = document.getElementById("input");
const output = document.getElementById("output");
const ws = new WebSocket(`wss://${location.host}/mindus/live`);
ws.onmessage = ({ data }) => output.innerText += data + "\n";
form.addEventListener("submit", (e) => {
e.preventDefault();
output.innerText += `=> ${input.value}\n`;
ws.send(input.value + "\n");
input.value = "";
});
</script>
</body>
</html>