betere sessies lol lmao even

This commit is contained in:
2025-08-16 09:51:29 +02:00
parent a1526ddc67
commit c7eb174a01
7 changed files with 331 additions and 110 deletions
+15
View File
@@ -52,6 +52,20 @@ export default function MobileVoting() {
);
}
// Main message handler and dispatcher
function onMessage(e) {
console.log(e);
let data = JSON.parse(e.data);
for (let key in data) {
if (key == "track") {
setYesHighlight(false);
setNoHighlight(false);
}
}
console.log(data);
//}, 1000);
}
// Initialize WebSocket connection when sessionId changes
useEffect(() => {
if (sessionId) {
@@ -59,6 +73,7 @@ export default function MobileVoting() {
const socket = new WebSocket(
`${process.env.NEXT_PUBLIC_WS_HOST}/voting/session/${sessionId}/`,
);
socket.onmessage = onMessage;
setSessionSocket(socket);
//setTimeout(() => connect(), 2000);
}