basic JSON-RPC parser

This commit is contained in:
badaix 2015-08-30 23:56:31 +02:00
parent 77eab9f681
commit ccc84fb916
2 changed files with 96 additions and 7 deletions

View file

@ -115,11 +115,11 @@ void ControlSession::reader()
{
boost::asio::streambuf response;
boost::asio::read_until(*socket_, response, "\r\n");
std::istream response_stream(&response);
std::string strResponse;
response_stream >> strResponse;
std::string s((istreambuf_iterator<char>(&response)), istreambuf_iterator<char>());
s.resize(s.length() - 2);
if (messageReceiver_ != NULL)
messageReceiver_->onMessageReceived(this, strResponse);
messageReceiver_->onMessageReceived(this, s);
}
}
catch (const std::exception& e)