fix: WebSocket funktioniert
This commit is contained in:
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user