Skip to content

Reconnect socket on server-initiated disconnect and re-sync on (re)connect - #10

Draft
supercargo wants to merge 1 commit into
maxill1:masterfrom
supercargo:pr-reconnect
Draft

Reconnect socket on server-initiated disconnect and re-sync on (re)connect#10
supercargo wants to merge 1 commit into
maxill1:masterfrom
supercargo:pr-reconnect

Conversation

@supercargo

Copy link
Copy Markdown

Problem

When the Volumio host reboots or shuts down it typically closes the socket.io connection as a server-initiated disconnect. With socket.io-client v2 the client does not auto-reconnect from a server-initiated disconnect, so the volumio-server socket stays dead until Node-RED is fully redeployed. Even on a normal reconnect, nothing re-requests state, so downstream volumio event nodes never re-sync.

Fix

  • On disconnect, if the reason is io server disconnect, call socket.connect() to re-arm the connection.
  • Pass explicit reconnection options (infinite attempts with backoff).
  • Emit getState on every (re)connect so consumers re-sync after the device returns.

Testing

Verified on real hardware (a miniDSP SHD running Volumio): power-cycling the device now reconnects and re-syncs within seconds, where it previously required a manual redeploy.

Opening as a draft — feedback welcome.

…nnect

A Volumio reboot/shutdown typically sends a server-initiated disconnect, which
socket.io v2 does not auto-reconnect from, so the node stays dead until a full
redeploy. Re-arm the socket manually on the "io server disconnect" reason, set
explicit reconnection options, and emit getState on every (re)connect so flow
state re-syncs after the device recovers.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@maxill1

maxill1 commented Jun 8, 2026

Copy link
Copy Markdown
Owner

Hi, I'm not using volumio anymore and I can't test the PR by myself.

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