json rpc basics

This commit is contained in:
badaix 2015-08-31 23:40:41 +02:00
parent 1b579ed2a6
commit 6121fdceae
6 changed files with 120 additions and 73 deletions

View file

@ -120,7 +120,7 @@ void StreamServer::onMessageReceived(ServerSession* connection, const msg::BaseM
{
msg::Command commandMsg;
commandMsg.deserialize(baseMessage, buffer);
if (commandMsg.command == "startStream")
if (commandMsg.getCommand() == "startStream")
{
msg::Ack ackMsg;
ackMsg.refersTo = commandMsg.id;
@ -132,8 +132,8 @@ void StreamServer::onMessageReceived(ServerSession* connection, const msg::BaseM
{
msg::Hello helloMsg;
helloMsg.deserialize(baseMessage, buffer);
connection->macAddress = helloMsg.macAddress;
logO << "Hello from " << connection->macAddress << "\n";
connection->macAddress = helloMsg.getMacAddress();
logO << "Hello from " << connection->macAddress << ", host: " << helloMsg.getHostName() << ", v" << helloMsg.getVersion() << "\n";
json j = {
{"event", "newConnection"},
{"client", {
@ -142,7 +142,6 @@ void StreamServer::onMessageReceived(ServerSession* connection, const msg::BaseM
}}
};
controlServer->send(j.dump());
}
}