- aria-data/config/AGENT.md — ARIAs Persönlichkeit und Sicherheitsregeln
- `aria-data/config/USER.md` — Stefans Präferenzen - `aria-data/config/TOOLING.md` — VM-Tooling Liste - `aria-data/skills/README.md` — Skill-Bauanleitung ### Bekannte Probleme - Android Release-Build: `EMFILE: too many open files` — Fix: `CI=true` in `build.sh` - JDK 21 inkompatibel mit AGP 8.1 — Fix: Automatischer Fallback auf JDK 17 - `react-native-screens` > 3.27.0 inkompatibel mit RN 0.73.4 — Fix: Version gepinnt
This commit is contained in:
+14
-5
@@ -8,7 +8,7 @@ const MAX_SESSIONS = parseInt(process.env.MAX_SESSIONS || "10", 10);
|
||||
|
||||
// Erlaubte Nachrichtentypen — alles andere wird verworfen
|
||||
const ALLOWED_TYPES = new Set([
|
||||
"chat", "audio", "file", "location", "mode", "log", "event",
|
||||
"chat", "audio", "file", "location", "mode", "log", "event", "heartbeat",
|
||||
]);
|
||||
|
||||
// Token-Raum: token -> { clients: Set<ws> }
|
||||
@@ -129,13 +129,14 @@ function registerClient(ws, token) {
|
||||
});
|
||||
}
|
||||
|
||||
// ── Heartbeat — hält Verbindungen am Leben ──────────────────────────
|
||||
// ── Heartbeat — hält Verbindungen am Leben, räumt tote auf ──────────
|
||||
|
||||
const HEARTBEAT_INTERVAL = 30_000;
|
||||
const HEARTBEAT_INTERVAL = 15_000;
|
||||
|
||||
const heartbeat = setInterval(() => {
|
||||
for (const client of wss.clients) {
|
||||
if (client.isAlive === false) {
|
||||
log(`Toter Client entfernt (kein Pong)`);
|
||||
client.terminate();
|
||||
continue;
|
||||
}
|
||||
@@ -147,10 +148,18 @@ const heartbeat = setInterval(() => {
|
||||
wss.on("connection", (ws) => {
|
||||
ws.isAlive = true;
|
||||
ws.on("pong", () => { ws.isAlive = true; });
|
||||
// App-seitiger Heartbeat (JSON) zaehlt auch als lebendig
|
||||
const origOnMessage = ws._events?.message;
|
||||
ws.on("message", (raw) => {
|
||||
try {
|
||||
const msg = JSON.parse(raw);
|
||||
if (msg.type === "heartbeat") ws.isAlive = true;
|
||||
} catch {}
|
||||
});
|
||||
});
|
||||
|
||||
// Aufräumen alle 60 Sekunden
|
||||
const cleanup = setInterval(cleanupRooms, 60_000);
|
||||
// Aufräumen alle 30 Sekunden (statt 60)
|
||||
const cleanup = setInterval(cleanupRooms, 30_000);
|
||||
|
||||
wss.on("close", () => {
|
||||
clearInterval(heartbeat);
|
||||
|
||||
Reference in New Issue
Block a user