(cobra client) ws cobra subscribe resubscribe at latest position after being disconnected
This commit is contained in:
parent
9801ebdb36
commit
44f599747e
@ -1,6 +1,10 @@
|
||||
# Changelog
|
||||
All changes to this project will be documented in this file.
|
||||
|
||||
## [8.2.5] - 2020-03-13
|
||||
|
||||
(cobra client) ws cobra subscribe resubscribe at latest position after being disconnected
|
||||
|
||||
## [8.2.4] - 2020-03-13
|
||||
|
||||
(cobra client) can subscribe with a position
|
||||
|
@ -6,4 +6,4 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#define IX_WEBSOCKET_VERSION "8.2.4"
|
||||
#define IX_WEBSOCKET_VERSION "8.2.5"
|
||||
|
@ -68,8 +68,10 @@ namespace ix
|
||||
|
||||
std::thread t(timer);
|
||||
|
||||
std::string subscriptionPosition(position);
|
||||
|
||||
conn.setEventCallback(
|
||||
[&conn, &channel, &jsonWriter, &filter, &position, &msgCount, &msgPerSeconds, &quiet, &fluentd](
|
||||
[&conn, &channel, &jsonWriter, &filter, &subscriptionPosition, &msgCount, &msgPerSeconds, &quiet, &fluentd](
|
||||
ix::CobraConnectionEventType eventType,
|
||||
const std::string& errMsg,
|
||||
const ix::WebSocketHttpHeaders& headers,
|
||||
@ -87,10 +89,11 @@ namespace ix
|
||||
else if (eventType == ix::CobraConnection_EventType_Authenticated)
|
||||
{
|
||||
spdlog::info("Subscriber authenticated");
|
||||
spdlog::info("Subscribing to {} at position {}", channel, subscriptionPosition);
|
||||
conn.subscribe(channel,
|
||||
filter,
|
||||
position,
|
||||
[&jsonWriter, &quiet, &msgPerSeconds, &msgCount, &fluentd](
|
||||
subscriptionPosition,
|
||||
[&jsonWriter, &quiet, &msgPerSeconds, &msgCount, &fluentd, &subscriptionPosition](
|
||||
const Json::Value& msg, const std::string& position) {
|
||||
if (!quiet)
|
||||
{
|
||||
@ -99,6 +102,8 @@ namespace ix
|
||||
|
||||
msgPerSeconds++;
|
||||
msgCount++;
|
||||
|
||||
subscriptionPosition = position;
|
||||
});
|
||||
}
|
||||
else if (eventType == ix::CobraConnection_EventType_Subscribed)
|
||||
|
Loading…
Reference in New Issue
Block a user