-
Notifications
You must be signed in to change notification settings - Fork 227
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add JSON-RPC access to directories and server lists (without connect/disconnect methods) #3479
base: main
Are you sure you want to change the base?
Conversation
Squash from: jamulussoftware#3249 rpc_notification jamulusclient/serverListReceived rpc_method jamulus/pollServerList Change JSON-RPC for server list. Use pollServerList instead of getServerList. (No result returned from the call.) Change "address" to "url" Adds documentation for new JSON-RPC methods Consistent use of countryId Fixes JSON-RPC docs JSON-RPC fixes for feedback to PR Changes method "jamulus/pollServerList" to "jamulusclient/pollServerList" (for consistency). Changes "url" to "address" in protocol and "server address" in docs. Fixes typo in countryId. JSON-RPC Enhancements Adds jamulusclient/connect method. Adds jamulusclient/disconnect method. Adds jamulusclient/serverInfoReceived notification. Return country string rather than (QT specific) country code. Request server info after server list received (to get each server's ping time and num clients). JSON-RPC enhancements Adds method jamulusclient/recorderState. Changes intrument code to instrument name (remote client may not have access to lookup table). Fixes errors in docs. Fixes coding style Update docs Fix coding style
d830548
to
324c588
Compare
These methods unfortunately break the GUI if called
324c588
to
3c89fe5
Compare
@@ -146,9 +163,9 @@ Results: | |||
| result.id | number | The channel ID. | | |||
| result.name | string | The musician’s name. | | |||
| result.skillLevel | string | The musician’s skill level (beginner, intermediate, expert, or null). | | |||
| result.countryId | number | The musician’s country ID (see QLocale::Country). | | |||
| result.country | string | The musician’s country. | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd suggest to add the id back...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Definitely. No problem with adding fields to the JSON, which can be used or ignored, but we should not remove existing fields that a JSON-RPC client might potentially be using already. So retain countryId
and instrumentId
, and add country
and instrument
as new fields.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| result.country | string | The musician’s country. | | |
| result.countryId | number | The musician’s country ID (see QLocale::Country). | | |
| result.country | string | The musician’s country. | |
@@ -444,9 +461,9 @@ Parameters: | |||
| params.clients[*].id | number | The channel ID. | | |||
| params.clients[*].name | string | The musician’s name. | | |||
| params.clients[*].skillLevel | string | The musician’s skill level (beginner, intermediate, expert, or null). | | |||
| params.clients[*].countryId | number | The musician’s country ID (see QLocale::Country). | | |||
| params.clients[*].country | string | The musician’s country. | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| params.clients[*].country | string | The musician’s country. | | |
| params.clients[*].countryId | number | The musician’s country ID (see QLocale::Country). | | |
| params.clients[*].country | string | The musician’s country. | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a number of suggestions.
| params.servers | array | The server list. | | ||
| params.servers[*].address | string | Socket address (ip_address:port) | | ||
| params.servers[*].name | string | Server name | | ||
| params.servers[*].country | string | Server country | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also include countryId
for consistency with jamulusclient/clientListReceived
suggestion above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| params.servers[*].country | string | Server country | | |
| params.servers[*].countryId | number | Server country ID (see QLocale::Country). | | |
| params.servers[*].country | string | Server country | |
@@ -53,9 +53,9 @@ CClientRpc::CClientRpc ( CClient* pClient, CRpcServer* pRpcServer, QObject* pare | |||
/// @param {number} params.clients[*].id - The channel ID. | |||
/// @param {string} params.clients[*].name - The musician’s name. | |||
/// @param {string} params.clients[*].skillLevel - The musician’s skill level (beginner, intermediate, expert, or null). | |||
/// @param {number} params.clients[*].countryId - The musician’s country ID (see QLocale::Country). | |||
/// @param {string} params.clients[*].country - The musician’s country. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/// @param {string} params.clients[*].country - The musician’s country. | |
/// @param {number} params.clients[*].countryId - The musician’s country ID (see QLocale::Country). | |
/// @param {string} params.clients[*].country - The musician’s country. |
/// @param {string} params.clients[*].city - The musician’s city. | ||
/// @param {number} params.clients[*].instrumentId - The musician’s instrument ID (see CInstPictures::GetTable). | ||
/// @param {string} params.clients[*].instrument - The musician’s instrument. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/// @param {string} params.clients[*].instrument - The musician’s instrument. | |
/// @param {number} params.clients[*].instrumentId - The musician’s instrument ID (see CInstPictures::GetTable). | |
/// @param {string} params.clients[*].instrument - The musician’s instrument. |
@@ -146,9 +163,9 @@ Results: | |||
| result.id | number | The channel ID. | | |||
| result.name | string | The musician’s name. | | |||
| result.skillLevel | string | The musician’s skill level (beginner, intermediate, expert, or null). | | |||
| result.countryId | number | The musician’s country ID (see QLocale::Country). | | |||
| result.country | string | The musician’s country. | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| result.country | string | The musician’s country. | | |
| result.countryId | number | The musician’s country ID (see QLocale::Country). | | |
| result.country | string | The musician’s country. | |
| result.city | string | The musician’s city. | | ||
| result.instrumentId | number | The musician’s instrument ID (see CInstPictures::GetTable). | | ||
| result.instrument | number | The musician’s instrument. | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| result.instrument | number | The musician’s instrument. | | |
| result.instrumentId | number | The musician’s instrument ID (see CInstPictures::GetTable). | | |
| result.instrument | string | The musician’s instrument. | |
QJsonObject objServerInfo{ | ||
{ "address", serverInfo.HostAddr.toString() }, | ||
{ "name", serverInfo.strName }, | ||
{ "country", QLocale::countryToString ( serverInfo.eCountry ) }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
{ "country", QLocale::countryToString ( serverInfo.eCountry ) }, | |
{ "countryId", serverInfo.eCountry }, | |
{ "country", QLocale::countryToString ( serverInfo.eCountry ) }, |
@@ -125,17 +199,17 @@ CClientRpc::CClientRpc ( CClient* pClient, CRpcServer* pRpcServer, QObject* pare | |||
/// @result {number} result.id - The channel ID. | |||
/// @result {string} result.name - The musician’s name. | |||
/// @result {string} result.skillLevel - The musician’s skill level (beginner, intermediate, expert, or null). | |||
/// @result {number} result.countryId - The musician’s country ID (see QLocale::Country). | |||
/// @result {string} result.country - The musician’s country. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/// @result {string} result.country - The musician’s country. | |
/// @result {number} result.countryId - The musician’s country ID (see QLocale::Country). | |
/// @result {string} result.country - The musician’s country. |
/// @result {string} result.city - The musician’s city. | ||
/// @result {number} result.instrumentId - The musician’s instrument ID (see CInstPictures::GetTable). | ||
/// @result {number} result.instrument - The musician’s instrument. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/// @result {number} result.instrument - The musician’s instrument. | |
/// @result {number} result.instrumentId - The musician’s instrument ID (see CInstPictures::GetTable). | |
/// @result {number} result.instrument - The musician’s instrument. |
/// @result {string} result.skillLevel - Your skill level (beginner, intermediate, expert, or null). | ||
pRpcServer->HandleMethod ( "jamulusclient/getChannelInfo", [=] ( const QJsonObject& params, QJsonObject& response ) { | ||
QJsonObject result{ | ||
// TODO: We cannot include "id" here is pClient->ChannelInfo is a CChannelCoreInfo which lacks that field. | ||
{ "name", pClient->ChannelInfo.strName }, | ||
{ "countryId", pClient->ChannelInfo.eCountry }, | ||
{ "country", QLocale::countryToString ( pClient->ChannelInfo.eCountry ) }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
{ "country", QLocale::countryToString ( pClient->ChannelInfo.eCountry ) }, | |
{ "countryId", pClient->ChannelInfo.eCountry }, | |
{ "country", QLocale::countryToString ( pClient->ChannelInfo.eCountry ) }, |
{ "city", pClient->ChannelInfo.strCity }, | ||
{ "instrumentId", pClient->ChannelInfo.iInstrument }, | ||
{ "instrument", CInstPictures::GetName ( pClient->ChannelInfo.iInstrument ) }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
{ "instrument", CInstPictures::GetName ( pClient->ChannelInfo.iInstrument ) }, | |
{ "instrumentId", pClient->ChannelInfo.iInstrument }, | |
{ "instrument", CInstPictures::GetName ( pClient->ChannelInfo.iInstrument ) }, |
Short description of changes
Modified version of: #3249
Quoting the initial PR:
CHANGELOG: Added jamulusclient/pollServerList methods and jamulusclient/receivedServerList notification to JSON-RPC interface.
Context: Fixes an issue?
Does this change need documentation? What needs to be documented and how?
Status of this Pull Request
To be tested.
What is missing until this pull request can be merged?
Checklist