Commit a48f839a authored by Alex Hultman's avatar Alex Hultman
Browse files

Strip last 4 in deflate, enable send compression in Autobahn

parent 7e48e7da
...@@ -34,11 +34,11 @@ char *Hub::deflate(char *data, size_t &length) { ...@@ -34,11 +34,11 @@ char *Hub::deflate(char *data, size_t &length) {
if (dynamicZlibBuffer.length()) { if (dynamicZlibBuffer.length()) {
dynamicZlibBuffer.append(zlibBuffer, DEFLATE_OUTPUT_CHUNK - deflationStream.avail_out); dynamicZlibBuffer.append(zlibBuffer, DEFLATE_OUTPUT_CHUNK - deflationStream.avail_out);
length = dynamicZlibBuffer.length(); length = dynamicZlibBuffer.length() - 4;
return (char *) dynamicZlibBuffer.data(); return (char *) dynamicZlibBuffer.data();
} }
length = DEFLATE_OUTPUT_CHUNK - deflationStream.avail_out; length = DEFLATE_OUTPUT_CHUNK - deflationStream.avail_out - 4;
return zlibBuffer; return zlibBuffer;
} }
......
...@@ -28,7 +28,7 @@ void testAutobahn() { ...@@ -28,7 +28,7 @@ void testAutobahn() {
uWS::Group<uWS::SERVER> *group = h.createGroup<uWS::SERVER>(uWS::PERMESSAGE_DEFLATE); uWS::Group<uWS::SERVER> *group = h.createGroup<uWS::SERVER>(uWS::PERMESSAGE_DEFLATE);
auto messageHandler = [](uWS::WebSocket<uWS::SERVER> *ws, char *message, size_t length, uWS::OpCode opCode) { auto messageHandler = [](uWS::WebSocket<uWS::SERVER> *ws, char *message, size_t length, uWS::OpCode opCode) {
ws->send(message, length, opCode); ws->send(message, length, opCode, nullptr, nullptr, true);
}; };
sslGroup->onMessage(messageHandler); sslGroup->onMessage(messageHandler);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment