-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsocket.html
More file actions
27 lines (27 loc) · 943 Bytes
/
socket.html
File metadata and controls
27 lines (27 loc) · 943 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
<!-- Manually test the socket functions -->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<script src="https://cdn.jsdelivr.net/npm/socket.io-client@2/dist/socket.io.js"></script>
<script>
const socket = io("ws://localhost:3000", {
query: {
// campaign_uuids: JSON.stringify([
// "8d56eaa6-35ca-4817-8cb7-e94c706ad237",
// "92f3736a-d169-4cec-b02c-2ba4c0482e72",
// ]),
},
});
socket.on("connect", () => {
console.log("Connected");
});
socket.emit("subscribe", JSON.stringify(["2fb1500e-fa6d-4dda-9f74-c036a9b63fc6"]));
socket.on("vote", data => console.log(data));
</script>
<title>Document</title>
</head>
<body></body>
</html>