forked from motora-ai/moving-vehicles-toy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
82 lines (76 loc) · 2.56 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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
<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 vehicleSocket = io('http://localhost:3000/vehicles/ws');
vehicleSocket.on('connect', function () {
console.log('Connected');
});
vehicleSocket.on('events', function (data) {
console.log('event', data);
});
vehicleSocket.on('vehicle-created', function (data) {
console.log('vehicle-created', data.data);
})
vehicleSocket.on('vehicle-updated', function (data) {
console.log('vehicle-updated', data.data);
});
vehicleSocket.on('vehicle-deleted', function (data) {
console.log('vehicle-deleted', data.data);
});
vehicleSocket.on('exception', function (data) {
console.log('exception', data);
});
vehicleSocket.on('disconnect', function () {
console.log('Disconnected');
});
const travelsSocket = io('http://localhost:3000/travels/ws');
travelsSocket.on('connect', function () {
console.log('Connected');
});
travelsSocket.on('events', function (data) {
console.log('event', data);
});
travelsSocket.on('travel-created', function (data) {
console.log('travel-created', data.data);
})
travelsSocket.on('travel-updated', function (data) {
console.log('travel-updated', data.data);
});
travelsSocket.on('travel-deleted', function (data) {
console.log('travel-deleted', data.data);
});
travelsSocket.on('exception', function (data) {
console.log('exception', data);
});
travelsSocket.on('disconnect', function () {
console.log('Disconnected');
});
const driversSocket = io('http://localhost:3000/drivers/ws');
driversSocket.on('connect', function () {
console.log('Connected');
});
driversSocket.on('events', function (data) {
console.log('event', data);
});
driversSocket.on('driver-created', function (data) {
console.log('driver-created', data.data);
})
driversSocket.on('driver-updated', function (data) {
console.log('driver-updated', data.data);
});
driversSocket.on('driver-deleted', function (data) {
console.log('driver-deleted', data.data);
});
driversSocket.on('exception', function (data) {
console.log('exception', data);
});
driversSocket.on('disconnect', function () {
console.log('Disconnected');
});
</script>
</head>
<body>Open the console to watch the socket response</body>
</html>