Fix: prevent mobile web remote desktop freeze on Safari app-switch
by forcing clean WS reconnect on foreground return; add 30-second grace period on server to avoid cold-start on quick reconnects
This commit is contained in:
@@ -244,7 +244,7 @@ func (h *wsHub) handleDisconnect(c *wsClient, _ []byte) {
|
||||
h.mu.Unlock()
|
||||
c.queue([]byte(`{"cmd":"disconnect_result","ok":true}`))
|
||||
if prev != "" && h.countWatchers(prev) == 0 {
|
||||
h.devices.CloseScreen(prev)
|
||||
h.deferredCloseScreen(prev)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -288,6 +288,11 @@ func (h *wsHub) handleConnect(c *wsClient, raw []byte) {
|
||||
c.queueBinary(cache.Keyframe)
|
||||
}
|
||||
h.mu.Lock()
|
||||
// Cancel any pending deferred close so the relay stays alive.
|
||||
if t, ok := h.screenCloseTimers[in.ID]; ok {
|
||||
t.Stop()
|
||||
delete(h.screenCloseTimers, in.ID)
|
||||
}
|
||||
c.watching = in.ID
|
||||
h.mu.Unlock()
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user