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:
committed by
Benjamin Sergeant
parent
ff75846d2d
commit
93debc00dc
@ -70,6 +70,11 @@ namespace ix
|
||||
std::lock_guard<std::mutex> lock(_configMutex);
|
||||
_url = url;
|
||||
}
|
||||
void WebSocket::setExtraHeaders(const std::unordered_map<std::string, std::string>& headers)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(_configMutex);
|
||||
_extraHeaders = headers;
|
||||
}
|
||||
|
||||
const std::string& WebSocket::getUrl() const
|
||||
{
|
||||
@ -176,7 +181,7 @@ namespace ix
|
||||
_pingTimeoutSecs);
|
||||
}
|
||||
|
||||
WebSocketInitResult status = _ws.connectToUrl(_url, timeoutSecs);
|
||||
WebSocketInitResult status = _ws.connectToUrl(_url, _extraHeaders, timeoutSecs);
|
||||
if (!status.success)
|
||||
{
|
||||
return status;
|
||||
|
Reference in New Issue
Block a user