-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
46 lines (40 loc) · 1.04 KB
/
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<html>
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/2.0.4/socket.io.js"></script>
<title>People Counter</title>
</head>
<style>
body {
font-family: sans-serif;
background-color: #ddd;
}
#container {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
font-size: 2em;
}
h1 {
font-size: 5em;
padding: 25px;
}
</style>
<script>
// Connect to the socket server.
// Since the IP is not provided, it defaults to the current page's host.
let socket = io()
// Listen for update event. Runs every time people count changes.
socket.on('UPDATE_COUNT', (peopleCount) => {
// Use JQuery to replace the text on the element
$('#peopleCount').text(peopleCount)
})
</script>
<body>
<div id='container'>
<h1 id='peopleCount'>0</h1>
<h2>PEOPLE</h2>
</div>
</body>
</html>