-
Notifications
You must be signed in to change notification settings - Fork 0
/
dashboard.html
32 lines (29 loc) · 924 Bytes
/
dashboard.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Easyhome - Dashboard</title>
</head>
<body>
<button onclick="sendMessage('CLAPS')">CLAPS</button>
<script>
const url = `wss://easyhome-server.glitch.me/ws`;
// const url = `ws://localhost:3000/ws`;
const socket = new WebSocket(url);
// Connection opened
socket.addEventListener('open', function (event) {
console.log("connected");
socket.send("VISIT");
});
// Listen for messages
socket.addEventListener('message', function (event) {
console.log('Message from server ', event.data);
});
function sendMessage(message){
console.log('sending message', message);
socket.send(message);
}
</script>
</body>
</html>