Skip to content

Add JSON-RPC methods to connect, disconnect and query connection state#3806

Draft
mcfnord wants to merge 3 commits into
jamulussoftware:mainfrom
mcfnord:client-connection-rpc
Draft

Add JSON-RPC methods to connect, disconnect and query connection state#3806
mcfnord wants to merge 3 commits into
jamulussoftware:mainfrom
mcfnord:client-connection-rpc

Conversation

@mcfnord

@mcfnord mcfnord commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

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 CClient connection state machine introduced in #3805. This closes the largest UI/RPC parity gap named in #3801 (join/leave) and makes a --nogui client 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 existing connected/disconnected notifications, 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.md regenerated via tools/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: --nogui client + local server on Linux/Qt 5.15, driven entirely over JSON-RPC. Scripted checks (16/16 pass): initial state disconnected; connectconnecting notification → connectionStateChanged: connectingconnected (channel ID) → connectionStateChanged: connectedgetConnectionState returns server name; connect-while-connected performs a clean reconnect (disconnectedconnectingconnected); disconnectdisconnected + connectionStateChanged: disconnected, serverName cleared; double disconnect is a no-op.

Checklist

  • I've verified that this Pull Request follows the general code principles
  • I tested my code and it does what I want
  • My code follows the style guide
  • I waited some time after this Pull Request was opened and all GitHub checks completed without errors.
  • I've filled all the content above

AUTOBUILD: Please build all targets

🤖 Generated with Claude Code

pgScorpio and others added 3 commits July 19, 2026 01:01
This is an extract from jamulussoftware#2550
Co-authored-by: ann0see <20726856+ann0see@users.noreply.github.com>
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 <noreply@anthropic.com>
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 <noreply@anthropic.com>
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