From b10f78bd78e7f2a474afec37b13d91f0d1fdcc6e Mon Sep 17 00:00:00 2001 From: badaix Date: Sun, 26 Feb 2017 00:41:25 +0100 Subject: [PATCH] update --- doc/json_rpc_api/v2_0_0.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/doc/json_rpc_api/v2_0_0.md b/doc/json_rpc_api/v2_0_0.md index 3a529fa2..8b76281f 100644 --- a/doc/json_rpc_api/v2_0_0.md +++ b/doc/json_rpc_api/v2_0_0.md @@ -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)