(ws cobra_subscribe) add a --fluentd option to wrap a message in an enveloppe so that fluentd can recognize it

This commit is contained in:
Benjamin Sergeant
2020-03-09 15:25:43 -07:00
parent 4ef04b8339
commit b1f30bb40f
6 changed files with 56 additions and 27 deletions

View File

@ -30,8 +30,14 @@ namespace ix
void start();
void stop();
int getSentBytes() { return _sentBytes; }
int getReceivedBytes() { return _receivedBytes; }
int getSentBytes()
{
return _sentBytes;
}
int getReceivedBytes()
{
return _receivedBytes;
}
void sendMessage(const std::string& text);
@ -76,19 +82,16 @@ namespace ix
_webSocket.addSubProtocol(subprotocol);
}
WebSocket::setTrafficTrackerCallback(
[this](int size, bool incoming)
WebSocket::setTrafficTrackerCallback([this](int size, bool incoming) {
if (incoming)
{
if (incoming)
{
_receivedBytes += size;
}
else
{
_sentBytes += size;
}
_receivedBytes += size;
}
);
else
{
_sentBytes += size;
}
});
}
void WebSocketConnect::log(const std::string& msg)