(cobra connection) retrieve cobra server connection id from the cobra handshake message and display it in ws clients, metrics publisher and bots

This commit is contained in:
Benjamin Sergeant
2020-09-22 09:30:19 -07:00
parent 62d220f49a
commit 97cc543e53
8 changed files with 38 additions and 7 deletions

View File

@@ -91,13 +91,14 @@ namespace ix
const std::string& errorMsg,
const WebSocketHttpHeaders& headers,
const std::string& subscriptionId,
CobraConnection::MsgId msgId)
CobraConnection::MsgId msgId,
const std::string& connectionId)
{
std::lock_guard<std::mutex> lock(_eventCallbackMutex);
if (_eventCallback)
{
_eventCallback(
std::make_unique<CobraEvent>(eventType, errorMsg, headers, subscriptionId, msgId));
std::make_unique<CobraEvent>(eventType, errorMsg, headers, subscriptionId, msgId, connectionId));
}
}
@@ -352,6 +353,18 @@ namespace ix
if (!nonce.isString()) return false;
if (!data.isMember("connection_id")) return false;
Json::Value connectionId = data["connection_id"];
if (!connectionId.isString()) return false;
invokeEventCallback(ix::CobraEventType::Handshake,
std::string(),
WebSocketHttpHeaders(),
std::string(),
0,
connectionId.asString());
return sendAuthMessage(nonce.asString());
}