Skip to content

fix(remote-connect): reconnect after server closes the transport - #3658

Merged
bobleer merged 2 commits into
GCWing:mainfrom
guantw:fix/relay-server-close-reconnect
Nov 2, 2026
Merged

bobleer merged 2 commits into
GCWing:mainfrom
guantw:fix/relay-server-close-reconnect

Conversation

@guantw

@guantw guantw commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

Summary

Server-initiated Engine.IO or WebSocket closes could leave the account connection waiting on open Socket.IO receivers, preventing automatic reconnection and device presence recovery.

Forward close events through both protocol layers and close the engine input queue before notifying the Socket.IO manager. Existing reconnect logic can then reauthenticate, register the device, and refresh presence without deadlocking on queued writes. Wire formats and reconnect policy are unchanged.

Verification

  • 81 Engine.IO library tests passed, including close notification and shutdown under backpressure.
  • 6 RelayClient tests passed, including both server-close forms, device re-registration, RPC recovery, and failure of unacknowledged requests without replay.
  • A loopback fixture using the production Relay, two virtual devices, and a controller passed Engine.IO close, WebSocket close, TCP interruption, bidirectional RPC recovery, event delivery, unaffected-peer continuity, and intentional disconnect checks. The same fixture detected the reconnect failure without the fix.
  • git diff --check passed.

Remote control and peer messaging were exercised at the protocol level on one host. Physical Windows/macOS/mobile combinations were not exercised.

guantw and others added 2 commits November 1, 2026 22:28
Propagate Engine.IO and WebSocket close notifications to Socket.IO so account
connections can reconnect and restore device presence. Close the engine input
queue before notification to release blocked sends.

Cover re-registration, RPC recovery, unacknowledged request failure without
replay, and shutdown under backpressure.
@bobleer
bobleer merged commit 2e074ad into GCWing:main Nov 2, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants