fix: WebSocket funktioniert

This commit is contained in:
ISA
2025-06-12 07:16:38 +02:00
parent 0a97c359d8
commit 71df8df72d
10 changed files with 10 additions and 1923 deletions

View File

@@ -34,8 +34,8 @@ app.prepare().then(() => {
const io = new Server(server);
io.on("connection", socket => {
const { m: idMap, u: idUser, mode } = socket.handshake.query;
console.log(`🔌 WebSocket verbunden (idMap=${idMap}, idUser=${idUser}, mode=${mode})`);
const { m: idMap, u: idUser } = socket.handshake.query;
console.log(`🔌 WebSocket verbunden (idMap=${idMap}, idUser=${idUser})`);
const endpoints = [
{
@@ -79,7 +79,7 @@ app.prepare().then(() => {
const jsonStr = fs.readFileSync(mockPath, "utf-8");
const json = JSON.parse(jsonStr);
statis = extractData(json, name);
//console.log(`🧪 [Mock] ${name}`);
console.log(`🧪 [Mock] ${name}`);
} else {
const fetchUrl = `http://localhost/talas5/ClientData/${getUrl()}`;
const res = await fetch(fetchUrl);
@@ -115,7 +115,7 @@ app.prepare().then(() => {
// fetchData immer ausführen unabhängig vom Modus
fetchData();
const interval = setInterval(fetchData, 12000); // 12 Sekunden ,TALAS.web nutzt auch 12 Sekunden
const interval = setInterval(fetchData, 5000); // 5 Sekunden ,TALAS.web nutzt 12 Sekunden
socket.on("disconnect", () => {
clearInterval(interval);
console.log("❌ WebSocket getrennt");