Skip to content

Conversation

@dtinth
Copy link
Contributor

@dtinth dtinth commented Sep 7, 2021

Work in progress

Corresponding Jamulus PR: jamulussoftware/jamulus#1975

Does this need translation?

  • Yes
  • No

Changes

---

# JSON-RPC interface

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I assume this page will grow in time (and is already quite extensive), you may want to add a table of contents.

Suggested change
{:.no_toc}
This manual documents the JSON-RPC-based protocol by which you can control the Jamulus client and server.
<details markdown="1">
<summary>Table of contents</summary>
* TOC
{:toc}
</details>

Copy link
Contributor Author

@dtinth dtinth Sep 8, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gilgongo I am thinking about whether we need an extensive documentation for JSON-RPC at all…

My concern is that this would double the work required to make changes to the JSON-RPC interface. First you would need to make changes in jamulus project, and then you would need to document the method here in jamuluswebsite.

I think that adds substantial maintenance burden. I want to avoid having to make changes to 2 repositories and filing 2 PRs. So, upon second thought, I am thinking of doing either of these:

  • Point the reader to read clientrpc.cpp and serverrpc.cpp. Since the code is quite self-documenting already, it may be a redundant to have an English documentation at all.

  • Add some code comments directly in clientrpc.cpp and serverrpc.cpp and create a Python script to generate a Markdown documentation based on these comments (e.g. tools/generate_rpc_docs.py). The documentation would live directly in jamulus repository, e.g. RPC.md, and jamuluswebsite would just link there. Maybe some GitHub Actions could be created to ensure that this documentation is up-to-date. This would also lets reader view the documentation of a specific release.

    The comment might look like this:

    /* For notifications */
          /// @rpc_notification jamulusclient/clientListReceived
          /// @brief Emitted when the client list is received.
          /// @param {array} params.clients - The client list.
          /// @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).
          /// @param {string} params.clients[*].city - The musician’s city.
          /// @param {number} params.clients[*].instrumentId - The musician’s instrument ID (see CInstPictures::GetTable).
    
    /* For methods */
          /// @rpc_method jamulusclient/setSkillLevel
          /// @brief Sets your skill level.
          /// @param {string} params.skillLevel - The new skill level (beginner, intermediate, expert, or null).
          /// @result {string} result - Always "ok".
    

Suggestions or opinions?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not qualified to say, but if it's self-documenting, then less work is always better/safer.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we add a more extensive documentation to the file (md table like here and then link the comment from here)? I don’t think people should be forced to read the code. But they can of course read comments - although that’s not optimal (consistency, style) but ok for an experimental feature.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should also consider the audience of this documentation: It will be developers (not necessarily Jamulus developers or C++ developers). They should already be familiar with reading code or at least comments in the code. I like the idea of having a single place to handle both the code and the directly related docs.

I think we should still keep the first part in the "wiki" (everything including the Example paragraph?), put the method documentation right next to the code and link from the wiki page to the code.

@ignotus666
Copy link
Member

Are we going to translate this? It's very technical, and I'd assume anyone using it would be familiar with the terminology in English, but I'll go with the consensus. If we're not, it should go in wiki/en-no-translate/.

@gilgongo
Copy link
Member

gilgongo commented Sep 8, 2021

I was assuming we would (I'd actually checked the box on behalf of @dtinth), but if not then the adopted convention is that we'd not put it not on the website but in an .md file in the main repo I think? I didn't know about wiki/en-no-translate/ though!

@ignotus666
Copy link
Member

The reason I raise the issue of translation is that it contains a lot of vocabulary that is very technical and specific, which I'm not entirely sure has translations that are commonly used in different languages. I'm not a programmer, but as English is effectively the lingua franca for programming, translations heavy in technical terms may even be harder to understand than the original.

Yes, wiki/en-no-translate/ is where files that don't get translated go, so the .po folders don't get cluttered with unnecessary files. Links to them work exactly the same as to the files in wiki/en/ (i.e., you don't need to specifiy the en-no-translate path).

@gilgongo
Copy link
Member

gilgongo commented Sep 8, 2021

OK in that case we can just put it in wiki/en-no-translate/ and it can be on the website.

@ignotus666
Copy link
Member

ignotus666 commented Sep 8, 2021

It should be moved there before merging though, otherwise it's going to create a bunch of unwanted .po files. Tagging @dtinth

If other @jamulussoftware/translators want to chime in though that would be great.

@gilgongo
Copy link
Member

gilgongo commented Sep 8, 2021

Oh BTW OT but just seen this line in _config.yml

exclude_from_localization: ["assets", "images", "css", "README.md", "manifest.json", "humans.txt", "sitemap.xml", "robots.txt", "404.html", "CNAME", "LICENSE.md"]

Is there a reason wiki/en-no-translate/ isn't listed there?

(Also notice that the site variable seems to have been removed - anyone know why?)

@ignotus666
Copy link
Member

ignotus666 commented Sep 8, 2021

I suppose wiki/en-no-translate/ could go in there, yes. As 'site' gets prepended with an underscore (_site) it doesn't get included in the site at all, so needn't be included in the list. That's my guess anyway.

@dtinth
Copy link
Contributor Author

dtinth commented Sep 8, 2021

@ignotus666

The reason I raise the issue of translation is that it contains a lot of vocabulary that is very technical and specific, which I'm not entirely sure has translations that are commonly used in different languages. I'm not a programmer, but as English is effectively the lingua franca for programming, translations heavy in technical terms may even be harder to understand than the original.

I totally agree... I will move this to wiki/en-no-translate.

@gilgongo gilgongo deleted the branch jamulussoftware:next-release October 23, 2021 16:50
@gilgongo gilgongo closed this Oct 23, 2021
@ann0see ann0see reopened this Feb 15, 2022
@ann0see
Copy link
Member

ann0see commented Feb 15, 2022

Going to re-open this. @dtinth @gilgongo I raised the question if this should go to the KB or not

@ann0see
Copy link
Member

ann0see commented Feb 15, 2022

Suggestion:

  • Add a short document to the wiki linking to the jsonrpc code file
  • Add a well formatted documenting comment in the code
  • Link the comment from the website

@gilgongo
Copy link
Member

See my comment on jamulussoftware/jamulus#1975 (comment) - I'm note sure I underand how this PR relates to that one.

@dtinth
Copy link
Contributor Author

dtinth commented Feb 16, 2022

@ann0see @gilgongo @hoffie My original plan was to put the documentation in jamulus repo itself, e.g. in JSON-RPC.md, so that its documentation evolves alongside the codebase (similar to COMPILING.md) — that's why this PR was previously closed. I would rather not have to submit PRs to 2 different projects to update them. What do you think?

@gilgongo
Copy link
Member

@ann0see @gilgongo @hoffie My original plan was to put the documentation in jamulus repo itself, e.g. in JSON-RPC.md, so that its documentation evolves alongside the codebase (similar to COMPILING.md)

Yes, I think the "rule of thumb" is that if the information is aimed at developers messing with "code", then it goes into the repo (like you say, as COMPILING.md is). If it's to do with the "end usage" of Jamulus (so in this case what the effect of turning on the RPC option is, and some basic info on how to use it), then it's on the website (AKA "the wiki", although I'm not sure why we call it that).

@hoffie
Copy link
Member

hoffie commented Feb 16, 2022

Yes, sounds good to me. End-user-relevant things (CLI option, pointer to deeper docs) here in jamuluswebsite, deeper docs right next to (or even -- in the form of comments -- in) the code.

@ann0see
Copy link
Member

ann0see commented Feb 16, 2022

Ok. So next steps:

  1. Add a short entry to the website "we support JSON-RPC and please see the following comment in the code for available options" and CLI documentation
  2. Document all methods in the code.

@ann0see
Copy link
Member

ann0see commented Feb 16, 2022

Closing

@ann0see ann0see closed this Feb 16, 2022
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.

5 participants