-
Notifications
You must be signed in to change notification settings - Fork 3
/
master.html
57 lines (52 loc) · 1.69 KB
/
master.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
57
<html>
<head>
<script type="text/javascript" src="static/jquery.min.js"></script>
<script src="/socket.io/socket.io.js"></script>
<script>
var socket = io.connect('http://localhost:8080'),
clients = [];
$(document).ready(function(){
$("#play").click(function(){
socket.emit('masterEvent', {
'audioEvent': 'play'
});
});
$("#stop").click(function(){
socket.emit('masterEvent', {
'audioEvent': 'stop'
});
});
$("#reload").click(function(){
socket.emit('masterEvent', {
'audioEvent': 'reload'
});
});
$("#logSockets").click(function(){
socket.emit('masterEvent', {
'audioEvent': 'logSockets'
});
});
socket.emit('masterEvent', {
'audioEvent': 'requestClientList'
});
});
socket.on('masterEvent', function(data){
console.log(data);
if (data.audioEvent === 'updateSources') {
$("#clients").html(data.sources);
}
});
// socket.on('clientList', function(data){
// $("#clients").text(data.list);
// });
</script>
</head>
<body>
<input type="button" id="play" value="play"/>
<input type="button" id="stop" value="stop"/>
<input type="button" id="reload" value="reload"/><br>
currently connected:
<div id="clients">
</div>
</body>
</html>