Don't compress in EchoServer if large message

This commit is contained in:
Alex Hultman
2023-05-11 11:25:29 +02:00
parent f6f5a3d6e8
commit 023fbc6c3f
+4 -1
View File
@@ -33,7 +33,10 @@ int main() {
}, },
.message = [](auto *ws, std::string_view message, uWS::OpCode opCode) { .message = [](auto *ws, std::string_view message, uWS::OpCode opCode) {
ws->send(message, opCode, true); /* This is the opposite of what you probably want; compress if message is LARGER than 16 kb
* the reason we do the opposite here; compress if SMALLER than 16 kb is to allow for
* benchmarking of large message sending without compression */
ws->send(message, opCode, message.length() < 16 * 1024);
}, },
.drain = [](auto */*ws*/) { .drain = [](auto */*ws*/) {
/* Check ws->getBufferedAmount() here */ /* Check ws->getBufferedAmount() here */