From 98a9ce1bd09f78c0e49ffdeaf97832cedc99b8d6 Mon Sep 17 00:00:00 2001 From: John Freed Date: Thu, 19 Aug 2021 21:47:44 +0200 Subject: [PATCH] Created Json service (markdown) --- Json-service.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 Json-service.md diff --git a/Json-service.md b/Json-service.md new file mode 100644 index 0000000..f1ebfb7 --- /dev/null +++ b/Json-service.md @@ -0,0 +1,21 @@ +signal-cli (proposed release) supports a JSON RPC server that accepts input on STDIN and replies on STDOUT. See (https://github.com/AsamK/signal-cli/discussions/679) + +It is possible to communicate with the server over the network using named pipes. For example, the following command sets up a JSON RPC signal-cli server listening on local port 9182: + +`nc -l -p 9182 sigsocket &` + +To communicate with the server from the same machine (localhost), issue the command: +`nc localhost 9182` + +Enter your requests in the required format. Be sure to include the arbitrary "id" field if you want to receive a response! The response will contain the same "id" as its last field. For example: + +ENTRY: `{"jsonrpc":"2.0","method":"listGroups","id":"my special mark"}` + +REPLY: `{"jsonrpc":"2.0","result":[{"id":"Pmpi+EfPWmsxiomLe9Nx2XF9HOE483p6iKiFj65iMwI=","name":"My Group","description":"It's special because it is mine.","isMember":true,"isBlocked":false,"members":["+33123456789","+440123456789"],"pendingMembers":[],"requestingMembers":[],"admins":["+33123456789","+440123456789"],"groupInviteLink":"https://signal.group/#CjQKIAtcbUw482i7bqvmJCwdgvg0FMif52N5v9lGg_bE4U3zEhCjHKSaPzWImMpnCbU8A1r0"}],"id":"my special mark"}` + +From the command line: + +`echo '{"jsonrpc":"2.0","method":"listGroups","id":"my special mark"}' | signal-cli --output=json -u +33123456789 jsonRpc` + +You should receive the same response that the `nc` command provides. +