-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
27 lines (23 loc) · 846 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Rate Update</title>
</head>
<body>
<h1>Current rate: <span id="current-rate"></span></h1>
<h2>Next rate: <span id="next-rate"></span></h2>
<script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/4.1.2/socket.io.js"></script>
<script>
var socket = io.connect('http://' + document.domain + ':' + location.port);
socket.on('connect', function() {
console.log('Connected to server');
});
socket.on('update', function(data) {
document.getElementById('current-rate').innerText = data.current_rate;
document.getElementById('next-rate').innerText = data.next_rate;
});
</script>
</body>
</html>