Skip to content

Commit 5254066

Browse files
committed
reduce read buffer size
1 parent 7a76ffc commit 5254066

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

client/src/App.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,19 @@ void run(const oatpp::base::CommandLineArguments& args) {
9696
std::this_thread::sleep_for(std::chrono::milliseconds(200));
9797
}
9898

99+
99100
/* Once all clients are connected - start load */
101+
102+
oatpp::websocket::Config config;
103+
104+
config.maskOutgoingMessages = true;
105+
config.readBufferSize = 64;
106+
100107
for(auto& socket : ClientCoroutine::SOCKETS_LIST) {
108+
109+
socket->setConfig(config);
101110
executor->execute<ClientSenderCoroutine>(socket);
111+
102112
}
103113

104114
executor->join();

server/src/controller/WebSocketListener.hpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,11 @@ class WebSocketInstanceListener : public oatpp::websocket::AsyncConnectionHandle
9696
void onAfterCreate_NonBlocking(const std::shared_ptr<AsyncWebSocket>& socket, const std::shared_ptr<const ParameterMap>& params) override {
9797
++ SOCKETS;
9898

99+
oatpp::websocket::Config config;
100+
config.readBufferSize = 64;
101+
102+
socket->setConfig(config);
103+
99104
/* In this particular case we create one WebSocketListener per each connection */
100105
/* Which may be redundant in many cases */
101106
socket->setListener(std::make_shared<WebSocketListener>());

0 commit comments

Comments
 (0)