Add JSON-RPC methods to connect, disconnect and query connection state#3806
Draft
mcfnord wants to merge 3 commits into
Draft
Add JSON-RPC methods to connect, disconnect and query connection state#3806mcfnord wants to merge 3 commits into
mcfnord wants to merge 3 commits into
Conversation
This is an extract from jamulussoftware#2550 Co-authored-by: ann0see <[email protected]>
Introduce EConnectionState (disconnected / connecting / connected) owned by CClient as the single source of truth. A connection is 'requested' when the audio stream starts (CS_CONNECTING) and 'established' once the server assigns our channel ID (CS_CONNECTED). Every transition emits ConnectionStateChanged. Rename the Connected(name) signal emitted from Start() to Connecting(name), since at that point the connection is only requested, not established. CClient::Connect() now terminates any current connection first, so connecting while connected behaves as a reconnect. Co-Authored-By: Claude Fable 5 <[email protected]>
New methods: jamulusclient/connect, jamulusclient/disconnect and jamulusclient/getConnectionState. New notifications: jamulusclient/connecting, jamulusclient/connectingFailed and jamulusclient/connectionStateChanged. Together with the existing connected/disconnected notifications this gives JSON-RPC full parity with the UI for joining and leaving servers (jamulussoftware#3801) and makes a --nogui client fully scriptable. Co-Authored-By: Claude Fable 5 <[email protected]>
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.
Short description of changes
Stacked on #3805 — please review only the last commit here until that one merges.
Adds JSON-RPC control over the client's connection, as a symmetric consumer of the
CClientconnection state machine introduced in #3805. This closes the largest UI/RPC parity gap named in #3801 (join/leave) and makes a--noguiclient fully scriptable — e.g. a local web frontend where clicking a server joins it.New methods:
jamulusclient/connect{"address": "host:port", "serverName": "optional display name"}— terminates any current connection first, then connects (asynchronously; progress arrives via notifications).jamulusclient/disconnect— idempotent.jamulusclient/getConnectionState— returns{state: disconnected|connecting|connected, serverName}.New notifications:
jamulusclient/connecting,jamulusclient/connectingFailed,jamulusclient/connectionStateChanged. Together with the existingconnected/disconnectednotifications, an RPC consumer can follow the full lifecycle.Context: Fixes an issue?
Toward #3801 (full UI/RPC parity). Complementary to #3660 (directory getters).
Does this change need documentation? What needs to be documented and how?
docs/JSON-RPC.mdregenerated viatools/generate_json_rpc_docs.py(included).Status of this Pull Request
Draft until #3805 merges; the RPC commit itself is ready for review.
What is missing until this pull request can be merged?
#3805, then review.
Tested end-to-end:
--noguiclient + local server on Linux/Qt 5.15, driven entirely over JSON-RPC. Scripted checks (16/16 pass): initial statedisconnected;connect→connectingnotification →connectionStateChanged: connecting→connected(channel ID) →connectionStateChanged: connected→getConnectionStatereturns server name; connect-while-connected performs a clean reconnect (disconnected→connecting→connected);disconnect→disconnected+connectionStateChanged: disconnected,serverNamecleared; double disconnect is a no-op.Checklist
AUTOBUILD: Please build all targets
🤖 Generated with Claude Code