* some REST API consumers (like the Synology NAS) do not allow
to use an array for the recipients. So, in order to support
those platforms as well, a 'recipient' string parameter is added.
As most users are perfectly fine with the array parameter, the
recipient parameter won't be exposed in the Swagger UI.
see #428
* golang channels are meant to be 1:1 channels, so if multiple
goroutines listen on the same channel for messages, only one will
receive the message and the others are not, which lead to lost
messages.
In order to fix that, we create a dedicated golang channel for every
websocket connection.
see #451
* instead of starting signal-cli in json-rpc mode with the '-u',
we start signal-cli without the '-u' parameter (also known as
multi-account mode). This makes it possible to register a number in
json-rpc mode.
* when a message is successfully sent, signal-cli returns a timestamp,
which we convert to an integer. in case, we, for some reason can't
convert the timestamp to an integer, it means that signal-cli returned
some non-numeric characters as well (which is a strong indication that
there was an error). So, instead of returning the parsing error,
return the actual signal-cli error message.
see #412
Motivation
----------
The way how I fixed this is that both `Stdout` and `Stderr` are responded back to the client.
I don't think it's good practice to discard `$stderr` on success and to discard `$stdout` on error.
Let me know what you think. I'm still very new to Golang.
How to test
-----------
1. First of all you must be able to reproduce "CAPTCHA proof required" error (I guess you need to send a lot of messages to the same number)
2. Execute:
```
curl -X POST -H "Content-Type: application/json" 'http://localhost:8080/v2/send' \
-d '{"message": "Test via Signal API!", "number": "<SENDER_PHONE_NUMBER>", "recipients": [ "<RECIPIENT_PHONE_NUMBER>" ]}
'
```
3. See in the JSON response:
```
{"error":"Failed to send (some) messages:\n+49176xxxxxxxx: CAPTCHA proof required for sending to \"+49176xxxxxxxx\", available options \"RECAPTCHA, PUSH_CHALLENGE\" with challenge token \"1f209ee0-d487-4efc-xxxx-xxxxxxxxxxxx\", or wait \"86400\" seconds.\nTo get the captcha token, go to https://signalcaptchas.org/challenge/generate.html\nCheck the developer tools (F12) console for a failed redirect to signalcaptcha://\nEverything after signalcaptcha:// is the captcha token.\nUse the following command to submit the captcha token:\nsignal-cli submitRateLimitChallenge --challenge CHALLENGE_TOKEN --captcha CAPTCHA_TOKEN\nxxxxxxxxxxxxx\nFailed to send message\n"}
```
fix#403