Reconnect socket on server-initiated disconnect and re-sync on (re)connect - #10
Draft
supercargo wants to merge 1 commit into
Draft
Reconnect socket on server-initiated disconnect and re-sync on (re)connect#10supercargo wants to merge 1 commit into
supercargo wants to merge 1 commit into
Conversation
…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>
Owner
|
Hi, I'm not using volumio anymore and I can't test the PR by myself. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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-serversocket stays dead until Node-RED is fully redeployed. Even on a normal reconnect, nothing re-requests state, so downstreamvolumio eventnodes never re-sync.Fix
disconnect, if the reason isio server disconnect, callsocket.connect()to re-arm the connection.getStateon 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.