-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
41 lines (33 loc) · 955 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
32
33
34
35
36
37
38
39
40
41
<!doctype html>
<html>
<head>
<title>Socket.IO Rovers</title>
</head>
<body>
<button onclick="sendMove();">Move</button>
<button onclick="sendLeft();">Left</button>
<button onclick="sendRight();">Right</button>
<script src="/socket.io/socket.io.js"></script>
<script>
var socket = io();
socket.on('placement', function (data) {
console.log(data.toString());
});
socket.on('move', function (data) {
console.log(data.toString());
});
socket.on('turn', function (data) {
console.log(data.toString());
});
function sendMove(){
socket.emit('move', 'move');
}
function sendLeft(){
socket.emit('left', 'move');
}
function sendRight(){
socket.emit('right', 'right');
}
</script>
</body>
</html>