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:
1 parent
dd0bc263e0
commit
a13355d7e9
3 files changed
+64
-1
No files matched your search
@@ -153,6 +153,10 @@ try {
|
||||
Write-Host " [Exit: $exitCode]" -ForegroundColor $(if ($exitCode -eq 0) { "Green" } else { "Red" })
|
||||
Write-Host ""
|
||||
}
|
||||
"ping" {
|
||||
# Server-Heartbeat → mit pong antworten
|
||||
Send-WsMessage $ws '{"type":"pong"}' $ct
|
||||
}
|
||||
"pong" {
|
||||
# Heartbeat-Antwort - ignorieren
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user