From f772e40ad88a4098b250609148bedead2304c8cb Mon Sep 17 00:00:00 2001 From: Benjamin Sergeant Date: Tue, 7 Jul 2020 10:59:59 -0700 Subject: [PATCH] WebSocketPerMessageDeflateCompressor --- ixwebsocket/IXWebSocketPerMessageDeflateCodec.cpp | 10 ++++++++++ ixwebsocket/IXWebSocketPerMessageDeflateCodec.h | 4 ++++ 2 files changed, 14 insertions(+) diff --git a/ixwebsocket/IXWebSocketPerMessageDeflateCodec.cpp b/ixwebsocket/IXWebSocketPerMessageDeflateCodec.cpp index eb51a82d..d25b8e66 100644 --- a/ixwebsocket/IXWebSocketPerMessageDeflateCodec.cpp +++ b/ixwebsocket/IXWebSocketPerMessageDeflateCodec.cpp @@ -67,6 +67,16 @@ namespace ix } bool WebSocketPerMessageDeflateCompressor::compress(const std::string& in, std::string& out) + { + return compressData(in, out); + } + + bool WebSocketPerMessageDeflateCompressor::compress(const std::vector& in, std::string& out) + { + return compressData(in, out); + } + + template bool WebSocketPerMessageDeflateCompressor::compressData(const T& in, S& out) { // // 7.2.1. Compression diff --git a/ixwebsocket/IXWebSocketPerMessageDeflateCodec.h b/ixwebsocket/IXWebSocketPerMessageDeflateCodec.h index 3e70fa54..f445d136 100644 --- a/ixwebsocket/IXWebSocketPerMessageDeflateCodec.h +++ b/ixwebsocket/IXWebSocketPerMessageDeflateCodec.h @@ -9,6 +9,7 @@ #include "zlib.h" #include #include +#include namespace ix { @@ -20,6 +21,9 @@ namespace ix bool init(uint8_t deflateBits, bool clientNoContextTakeOver); bool compress(const std::string& in, std::string& out); + bool compress(const std::vector& in, std::string& out); + + template bool compressData(const T& in, S& out); private: static bool endsWith(const std::string& value, const std::string& ending);