-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
36 lines (32 loc) · 905 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
<html>
<head>
<script src="https://cdn.socket.io/4.3.2/socket.io.min.js"
integrity="sha384-KAZ4DtjNhLChOB/hxXuKqhMLYvx3b5MlT55xPEiNmREKRzeEm+RVPlTnAn0ajQNs" crossorigin="anonymous">
</script>
<script>
const socket = io('http://localhost:3004', {
transports: ['websocket'],
query: {
token: '5ff3a258-2700-11ed-a261-0242ac120002',
},
});
socket.on('connect', function () {
console.log('Connected');
socket.emit('events', {
test: 'test'
});
socket.emit('identity', 0, (response) => console.log('Identity:', response));
});
socket.on('events', function (data) {
console.log('event', data);
});
socket.on('exception', function (data) {
console.log('event', data);
});
socket.on('disconnect', function () {
console.log('Disconnected');
});
</script>
</head>
<body></body>
</html>