goweb/views/home/about.html

31 lines
690 B
HTML

{{define "home/about.html"}}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{{.title}}</title>
</head>
<body>
<script>
var ws = new WebSocket('ws://localhost:8080/ws');
ws.onopen = function () {
console.log('已连接');
ws.send('Hello, Server!');
}
ws.onerror = function (e) {
console.log(e);
}
ws.onmessage = function (e) {
console.log(e.data);
}
ws.onclose = function (e) {
console.log('断开连接');
}
</script>
</body>
</html>
{{end}}