Add client handshake extra headers (#105)

Even though 6455 defines all the necessary headers needed for
client/server handshake, in practice most of the cases websocket servers
expect few more headers. Therefore adding this functionality.
This commit is contained in:
ozychhi authored and Benjamin Sergeant committed 2019-08-26 09:37:40 -07:00
1 parent ff75846d2d
commit 93debc00dc
6 files changed
+34 -12

No files matched your search

+5
View File
@@ -21,6 +21,7 @@
#include <mutex>
#include <string>
#include <thread>
#include <unordered_map>
namespace ix
{
@@ -44,6 +45,8 @@ namespace ix
~WebSocket();
void setUrl(const std::string& url);
void setExtraHeaders(const std::unordered_map<std::string, std::string>&
headers); // send extra headers in client handshake request
void setPerMessageDeflateOptions(
const WebSocketPerMessageDeflateOptions& perMessageDeflateOptions);
void setHeartBeatPeriod(int heartBeatPeriodSecs);
@@ -111,6 +114,8 @@ namespace ix
WebSocketTransport _ws;
std::string _url;
std::unordered_map<std::string, std::string> _extraHeaders;
WebSocketPerMessageDeflateOptions _perMessageDeflateOptions;
mutable std::mutex _configMutex; // protect all config variables access