(WebSocketServer) add option to disable deflate compression, exposed with the -x option to ws echo_server

This commit is contained in:
Benjamin Sergeant
2020-02-18 21:38:28 -08:00
parent 111475e65c
commit 4c66a7561e
12 changed files with 61 additions and 22 deletions

View File

@@ -4,8 +4,8 @@
* Copyright (c) 2018 Machine Zone, Inc. All rights reserved.
*/
#include <ixwebsocket/IXWebSocketServer.h>
#include <ixwebsocket/IXNetSystem.h>
#include <ixwebsocket/IXWebSocketServer.h>
#include <spdlog/spdlog.h>
#include <sstream>
@@ -15,7 +15,8 @@ namespace ix
bool greetings,
const std::string& hostname,
const ix::SocketTLSOptions& tlsOptions,
bool ipv6)
bool ipv6,
bool disablePerMessageDeflate)
{
spdlog::info("Listening on {}:{}", hostname, port);
@@ -28,6 +29,12 @@ namespace ix
server.setTLSOptions(tlsOptions);
if (disablePerMessageDeflate)
{
spdlog::info("Disable per message deflate");
server.disablePerMessageDeflate();
}
server.setOnConnectionCallback(
[greetings](std::shared_ptr<ix::WebSocket> webSocket,
std::shared_ptr<ConnectionState> connectionState) {