mirror of
https://github.com/badaix/snapcast.git
synced 2025-05-11 08:06:41 +02:00
config holds list of clients
This commit is contained in:
parent
3a0b856afe
commit
707f198a26
3 changed files with 56 additions and 14 deletions
|
@ -25,6 +25,7 @@
|
|||
#include "common/log.h"
|
||||
#include "common/snapException.h"
|
||||
#include "jsonrpc.h"
|
||||
#include "config.h"
|
||||
#include <iostream>
|
||||
|
||||
using namespace std;
|
||||
|
@ -107,11 +108,16 @@ void ControlServer::onMessageReceived(ControlSession* connection, const std::str
|
|||
for (string s: request.params)
|
||||
logO << "param: " << s << "\n";
|
||||
|
||||
json response;
|
||||
|
||||
if (request.method == "get")
|
||||
{
|
||||
if (request.isParam(0, "status"))
|
||||
{
|
||||
|
||||
response = {
|
||||
{"server", "xxx"},
|
||||
{"clients", Config::instance().getClientInfos()}
|
||||
};
|
||||
}
|
||||
else
|
||||
throw JsonInvalidParamsException(request);
|
||||
|
@ -139,13 +145,6 @@ void ControlServer::onMessageReceived(ControlSession* connection, const std::str
|
|||
else
|
||||
throw JsonMethodNotFoundException(request);
|
||||
|
||||
json response = {
|
||||
{"test", "123"},
|
||||
{"error", {
|
||||
{"code", 12},
|
||||
{"message", true}
|
||||
}}};
|
||||
|
||||
connection->send(request.getResponse(response).dump());
|
||||
}
|
||||
catch (const JsonRequestException& e)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue