39 lines
1000 B
Cheetah
39 lines
1000 B
Cheetah
{{define "base"}}
|
|
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<title>{{template "title" .}}</title>
|
|
<script>
|
|
const ws = new WebSocket("wss://localhost:8443/ws");
|
|
|
|
ws.onopen = () => console.log("Connected")
|
|
ws.onmessage = (event) => console.log(event.data)
|
|
ws.onclose = () => console.log("Closed")
|
|
|
|
setInterval(() => {
|
|
if (ws.readyState === WebSocket.OPEN) {
|
|
const message = {
|
|
type: "ping",
|
|
timestamp: Date(),
|
|
random: Math.random()
|
|
};
|
|
|
|
ws.send(JSON.stringify(message))
|
|
}
|
|
}, 1000)
|
|
</script>
|
|
<style>
|
|
@import url('https://fonts.googleapis.com/css2?family=Alfa+Slab+One&display=swap');
|
|
</style>
|
|
<link rel="stylesheet" href="/static/style.css"/>
|
|
</head>
|
|
<body>
|
|
{{template "body" .}}
|
|
|
|
<h1>Hello, {{.Name}}!</h1>
|
|
<h1>This is THE PARTY.</h1>
|
|
</body>
|
|
</html>
|
|
{{end}}
|