Reconnect the built-in player after a dropped connection#1910
Open
marcelveldt wants to merge 3 commits into
Open
Reconnect the built-in player after a dropped connection#1910marcelveldt wants to merge 3 commits into
marcelveldt wants to merge 3 commits into
Conversation
sendspin-js auto-reconnect could never re-establish the connection: the WebSocket interceptor threw whenever no connection was pre-staged, killing the reconnect loop after a single attempt. The built-in player then stayed unavailable (e.g. after the browser suspended the tab) until a manual page refresh. - Rebuild the sendspin connection on demand in the WebSocket interceptor so sendspin-js's auto-reconnect works - Tie the sendspin session to the main API connection: tear down on disconnect, reconnect on restore - Let sendspin-js own transport-only drops (sendspin socket dies while the main connection stays up) - Remove the redundant player-timeout restart path - Add reconnect config with debug logging for observability
Member
Author
|
@maximmaxim345 maybe another pair of eyes from you ? |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes the built-in (sendspin) web player failing to recover after a dropped connection by making the /sendspin WebSocket interceptor resilient to sendspin-js auto-reconnect attempts and by aligning sendspin session lifecycle with the main API connection.
Changes:
- Reworked the
/sendspinWebSocket interceptor to (re)build a sendspin connection on demand during reconnect attempts, with deferred handler attachment and queued sends. - Updated the web player disconnect behavior to reset sendspin connection state and rely on App initialization to restore playback mode after reconnect.
- Added a sendspin-js reconnect configuration with debug logging for transport-only drops.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| src/plugins/web_player.ts | Removes the player-timeout restart path and resets sendspin connection on API disconnect so mode can be reapplied on reconnect. |
| src/plugins/sendspin-connection.ts | Rebuilds sendspin bridges on demand in the interceptor and changes event/handler plumbing for reconnect behavior. |
| src/components/SendspinPlayer.vue | Enables sendspin-js reconnect behavior with logging and backoff bounds. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Bail before flushing queued sends when the rebuilt bridge isn't open - Bind this to the wrapper when invoking the forwarded WebSocket handlers
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 Music Assistant tab is left open and the connection drops (for example the browser suspends the tab overnight), the built-in player stays unavailable until the page is refreshed — pressing play returns "Player … is not available".
The built-in player runs on sendspin-js, which has its own auto-reconnect. But our
/sendspinWebSocket interceptor threw whenever a connection wasn't pre-staged, so the first reconnect attempt failed and the loop gave up after a single try. The player never recovered on its own.Changes
setTabModeit triggered).