-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
63 lines (53 loc) · 1.48 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<html>
<head>
</head>
<body>
<script>
//set your client identifier
function INIT(id){
return JSON.stringify({
type: 'init',
value: id
});
}
//join room
function JOIN(room){
return JSON.stringify({
type: 'join',
value: room
});
}
function LEAVE(){
return JSON.stringify({
type: 'leave',
});
}
function SIGNAL(recipient, value){
return JSON.stringify({
type:'signal',
recipient:recipient,
value: value,
});
}
function PING(){
return JSON.stringify({
type:'ping'
})
}
//var ws = new WebSocket('ws://198.211.109.66');
var ws = new WebSocket('ws://localhost:8080');
ws.onopen = () => {
console.log('open');
ws.onmessage = (event) => {
console.log(event.data);
}
ws.onclose = (event) => {
console.log('close');
}
}
ws.onerror = (event) => {
console.log(event);
}
</script>
</body>
</html>