mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-20 11:05:54 +00:00
Improve websocket send performance (RIPD-1158)
This commit is contained in:
committed by
Nik Bougalis
parent
154e90b1ca
commit
b14555c742
@@ -288,15 +288,11 @@ ServerHandlerImp::onWSMessage(
|
|||||||
{
|
{
|
||||||
auto const jr =
|
auto const jr =
|
||||||
this->processSession(session, jc, jv);
|
this->processSession(session, jc, jv);
|
||||||
beast::streambuf sb;
|
auto const s = to_string(jr);
|
||||||
Json::stream(jr,
|
auto const n = s.length();
|
||||||
[&sb](auto const p, auto const n)
|
beast::streambuf sb(n);
|
||||||
{
|
sb.commit(boost::asio::buffer_copy(
|
||||||
sb.commit(boost::asio::buffer_copy(
|
sb.prepare(n), boost::asio::buffer(s.c_str(), n)));
|
||||||
sb.prepare(n), boost::asio::buffer(p, n)));
|
|
||||||
});
|
|
||||||
JLOG(m_journal.trace())
|
|
||||||
<< "Websocket sending '" << jr << "'";
|
|
||||||
session->send(std::make_shared<
|
session->send(std::make_shared<
|
||||||
StreambufWSMsg<decltype(sb)>>(std::move(sb)));
|
StreambufWSMsg<decltype(sb)>>(std::move(sb)));
|
||||||
session->complete();
|
session->complete();
|
||||||
|
|||||||
Reference in New Issue
Block a user