Skip to content
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

ip server connection tips #3101

Merged
merged 8 commits into from
Jul 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 20 additions & 3 deletions docs/JSON-RPC.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@

# Jamulus JSON-RPC Documentation
# Jamulus JSON-RPC Server Documentation

<!--
This file is automatically generated from the source code.
Do not edit this file manually.
See `tools/generate_json_rpc_docs.py` for details.
-->
mcfnord marked this conversation as resolved.
Show resolved Hide resolved

A JSON-RPC interface is available for both Jamulus client and server to allow programmatic access.
To use the JSON-RPC interface, run Jamulus with the `--jsonrpcport <port> --jsonrpcsecretfile /file/with/a/secret.txt` options.
A JSON-RPC server can be added to both Jamulus client and Jamulus server to allow programmatic access.
To add the JSON-RPC server, run Jamulus with the `--jsonrpcport <port> --jsonrpcsecretfile /file/with/a/secret.txt` options.
This will start a JSON-RPC server on the specified port on the localhost.

The file referenced by `--jsonrpcsecretfile` must contain a single line with a freely chosen string with at least 16 characters.
Expand All @@ -29,6 +29,23 @@ The JSON-RPC server is based on the [JSON-RPC 2.0](https://www.jsonrpc.org/speci
- A **response** from Jamulus to the consumer.
- A **notification** from Jamulus to the consumer.

## Connect to a JSON-RPC server

On Linux, you can connect to a JSON-RPC server using the `nc` CLI tool.

On Windows, [you can download](https://nmap.org/ncat/) and use the `ncat` CLI tool.

This snippet uses [jayson](https://www.npmjs.com/package/jayson) to connect using Node.js:

```
const jayson = require("jayson/promise");
const client = new jayson.client.tcp({ host: "127.0.0.1", port: 22100 });

client.request('jamulusserver/getServerInfo', {})
.then(console.log)
.catch(console.error)
```

## Example

After opening a TCP connection to the JSON-RPC server, the connection must be authenticated:
Expand Down
23 changes: 20 additions & 3 deletions tools/generate_json_rpc_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,16 +181,16 @@ def to_markdown(self):
items.sort(key=lambda item: item.name)

PREAMBLE = """
# Jamulus JSON-RPC Documentation
# Jamulus JSON-RPC Server Documentation

<!--
This file is automatically generated from the source code.
Do not edit this file manually.
See `tools/generate_json_rpc_docs.py` for details.
-->

A JSON-RPC interface is available for both Jamulus client and server to allow programmatic access.
To use the JSON-RPC interface, run Jamulus with the `--jsonrpcport <port> --jsonrpcsecretfile /file/with/a/secret.txt` options.
A JSON-RPC server can be added to both Jamulus client and Jamulus server to allow programmatic access.
pljones marked this conversation as resolved.
Show resolved Hide resolved
To add the JSON-RPC server, run Jamulus with the `--jsonrpcport <port> --jsonrpcsecretfile /file/with/a/secret.txt` options.
This will start a JSON-RPC server on the specified port on the localhost.

The file referenced by `--jsonrpcsecretfile` must contain a single line with a freely chosen string with at least 16 characters.
Expand All @@ -211,6 +211,23 @@ def to_markdown(self):
- A **response** from Jamulus to the consumer.
- A **notification** from Jamulus to the consumer.

## Connect to a JSON-RPC server

On Linux, you can connect to a JSON-RPC server using the `nc` CLI tool.

On Windows, [you can download](https://nmap.org/ncat/) and use the `ncat` CLI tool.

This snippet uses [jayson](https://www.npmjs.com/package/jayson) to connect using Node.js:

```
const jayson = require("jayson/promise");
const client = new jayson.client.tcp({ host: "127.0.0.1", port: 22100 });

client.request('jamulusserver/getServerInfo', {})
.then(console.log)
.catch(console.error)
```

## Example

After opening a TCP connection to the JSON-RPC server, the connection must be authenticated:
Expand Down