-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
31 lines (27 loc) · 838 Bytes
/
index.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
<html>
<head>
<style>
h1 { font-size: 3rem; font-weight: 200}
h2 { font-size: 2rem; font-weight: 200 }
body { font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif}
</style>
</head>
<body>
<h1>International Space Station Location</h1>
<script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/2.0.4/socket.io.js"></script>
<h2 id="lat"></h2>
<h2 id="long"></h2>
<script>
const sock = new WebSocket("ws://localhost:8080/socket");
sock.onopen = (ws, ev) => {
sock.onmessage = (ws) => {
console.log("message", ws)
const data = JSON.parse(ws.data)
document.getElementById('lat').textContent = `Latitude: ${data.latitude}`
document.getElementById('long').textContent = `Longitude: ${data.longitude}`
}
sock.send("hello")
}
</script>
</body>
</html>