This commit is contained in:
badaix 2017-02-26 00:41:25 +01:00
parent 664a01082e
commit b10f78bd78

View file

@ -1,5 +1,25 @@
Snapcast JSON RPC Control API
=============================
Snapcast can be controlled with a [JSON-RPC 2.0](http://www.jsonrpc.org/specification) API over a raw TCP-Socket interface on port 1705.
Single JSON Messages are new line delimited ([ndjson](http://ndjson.org/)).
For simple tests you can fire JSON commands on a telnet connection and watch Notifications:
```json
$ telnet localhost 1705
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
// Call Server.GetRPCVersion
{"id":8,"jsonrpc":"2.0","method":"Server.GetRPCVersion"}
// Response is:
{"id":8,"jsonrpc":"2.0","result":{"major":2,"minor":0,"patch":0}}
// Connect a client
{"jsonrpc":"2.0","method":"Client.OnConnect","params":{"client":{"config":{"instance":1,"latency":0,"name":"","volume":{"muted":false,"percent":74}},"connected":true,"host":{"arch":"x86_64","ip":"127.0.0.1","mac":"00:21:6a:7d:74:fc","name":"T400","os":"Linux Mint 17.3 Rosa"},"id":"00:21:6a:7d:74:fc","lastSeen":{"sec":1488065507,"usec":820050},"snapclient":{"name":"Snapclient","protocolVersion":2,"version":"0.11.0-beta-1"}},"id":"00:21:6a:7d:74:fc"}}
```
In the following the supported Requests and Notifications are described. The client that sends a "Set" command, will receive a Response while others will receive a Notification "On" event.
### Requests
* Client
* [Client.GetStatus](#clientgetstatus)