30 lines
754 B
HTML
30 lines
754 B
HTML
|
<!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>
|
||
|
|