Remote: Server-seitiger Heartbeat mit Timeout für tote WebSocket-Verbindungen

- Server sendet alle 30s Ping an Client, Client antwortet mit Pong
- LastActivityAt wird bei jeder empfangenen Nachricht aktualisiert
- Nach 90s Inaktivität wird Verbindung als tot erkannt und aufgeräumt
- HeartbeatLoop läuft parallel zum ReceiveLoop
- remote.ps1: ping-Handler hinzugefügt
This commit is contained in:
Meleki committed 2026-03-13 15:44:35 +01:00
1 parent dd0bc263e0
commit a13355d7e9
3 files changed
+64 -1

No files matched your search

+2
View File
@@ -17,6 +17,7 @@ public class RemoteConnection
public string Username { get; set; }
public string OsVersion { get; set; }
public DateTime ConnectedAt { get; set; }
public DateTime LastActivityAt { get; set; }
public string AssignedSessionId { get; set; }
public WebSocket Socket { get; set; }
@@ -42,6 +43,7 @@ public class RemoteConnectionManager
{
Id = Guid.NewGuid().ToString("N")[..12],
ConnectedAt = DateTime.UtcNow,
LastActivityAt = DateTime.UtcNow,
Socket = socket
};
_connections[conn.Id] = conn;