-
Notifications
You must be signed in to change notification settings - Fork 10.2k
Expand file tree
/
Copy pathindex.html
More file actions
34 lines (28 loc) · 1017 Bytes
/
index.html
File metadata and controls
34 lines (28 loc) · 1017 Bytes
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
<head></head>
<body>
<script type="text/javascript" src="https://cdn.socket.io/4.6.1/socket.io.js"></script>
<script type="text/javascript">
const params = new Proxy(new URLSearchParams(window.location.search), {
get: (searchParams, prop) => searchParams.get(prop),
});
console.log(params.id)
var is = io('http://localhost:3000/sessions', {
auth: {
token: 'aa',
room: params.id,
},
});
is.on('connect', () => {
console.log('a user connected');
});
is.on('disconnect', () => {
console.log('user disconnected');
});
is.on('connect_error', (err) => {
console.log('connect_error', err.message); // prints the message associated with the error
});
is.on('connect_msg', (data) => {
console.log('connect_msg', data); // prints the message associated with the error
});
</script>
</body>