add HTTP and websocket support (preliminary)

This commit is contained in:
badaix 2019-09-30 22:24:35 +02:00
parent 8920e8c710
commit 6566235831
10 changed files with 329 additions and 169 deletions

View file

@ -55,13 +55,18 @@ void ControlSessionTcp::do_read()
line.resize(line.size() - 1);
LOG(INFO) << "received: " << line << "\n";
if ((message_receiver_ != nullptr) && !line.empty())
message_receiver_->onMessageReceived(this, line);
{
string response = message_receiver_->onMessageReceived(this, line);
if (!response.empty())
sendAsync(response);
}
}
streambuf_.consume(bytes_transferred);
do_read();
});
}
void ControlSessionTcp::start()
{
do_read();