initial commit
This commit is contained in:
commit
b262e2d8ed
6 files changed
+190
No files matched your search
@@ -0,0 +1,30 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Ping Demo</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>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Hello, {{.Name}}!</h1>
|
||||
<p>This page sends a ping to the server every second.</p>
|
||||
</body>
|
||||
</html>
|
||||
Reference in new issue
Block a user