-
Notifications
You must be signed in to change notification settings - Fork 1
/
serverTest.html
56 lines (46 loc) · 1.13 KB
/
serverTest.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
47
48
49
50
51
52
53
54
55
56
<!doctype html>
<html>
<head>
<title>TH Server Testing!</title>
</head>
<script src="js/lib/socket.io.js"></script>
<script src="js/lib/jquery-3.3.1.min.js"></script>
<script src="js/lib/utils.js"></script>
<script>
// Open a socket to the server!
let token = getUrlParameter("token");
if (!token)
window.location.assign("login.html");
var socket = io.connect("localhost:3000?token=" + token);
socket.on("error", function()
{
console.log("Auth failure!");
});
socket.on("server send authentication", function(user)
{
console.log("Hi, I am " + user.display_name);
});
// Do other stuff!
socket.on("server send updateDay", function(data)
{
console.log(data);
});
socket.on("server send updatePlayers", function(data)
{
console.log(data);
});
socket.on("server send updateResources", function(data)
{
console.log(data);
});
socket.on("server send updateChat", function(data) {
console.log(data);
});
socket.on("server send endGame", function(data) {
console.log("END GAME");
});
socket.emit("player send joinGame");
</script>
<body>
</body>
</html>