lupt/static/index.html

66 lines
1.2 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="shortcut icon" href="#">
<title>Document</title>
</head>
<body>
<script>
// Create WebSocket connection.
const socket = new WebSocket('ws://localhost:8080/ws/');
// Connection opened
socket.addEventListener('open', function (event) {
socket.send('Hello Server!');
});
// Listen for messages
socket.addEventListener('message', function (event) {
console.log('Message from server ', event.data);
});
function wsend(p) {
socket.send(p);
}
function join(r, l) {
socket.send(JSON.stringify({
cmd: "join",
kunjika: r,
length: l
}));
}
function leave() {
socket.send(JSON.stringify({
cmd: "leave"
}));
}
function send(t) {
socket.send(JSON.stringify({
cmd: "text",
text: t
}));
}
function info(k, n, t) {
socket.send(JSON.stringify({
cmd: "seinfo",
kunjika: k,
name: n,
tags: t
}));
}
function joinrand() {
socket.send(JSON.stringify({
cmd: "rand"
}));
}
</script>
</body>
</html>