(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
|
# Changelog
|
||||||
All changes to this project will be documented in this file.
|
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
|
## [8.2.4] - 2020-03-13
|
||||||
|
|
||||||
(cobra client) can subscribe with a position
|
(cobra client) can subscribe with a position
|
||||||
|
@ -6,4 +6,4 @@
|
|||||||
|
|
||||||
#pragma once
|
#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::thread t(timer);
|
||||||
|
|
||||||
|
std::string subscriptionPosition(position);
|
||||||
|
|
||||||
conn.setEventCallback(
|
conn.setEventCallback(
|
||||||
[&conn, &channel, &jsonWriter, &filter, &position, &msgCount, &msgPerSeconds, &quiet, &fluentd](
|
[&conn, &channel, &jsonWriter, &filter, &subscriptionPosition, &msgCount, &msgPerSeconds, &quiet, &fluentd](
|
||||||
ix::CobraConnectionEventType eventType,
|
ix::CobraConnectionEventType eventType,
|
||||||
const std::string& errMsg,
|
const std::string& errMsg,
|
||||||
const ix::WebSocketHttpHeaders& headers,
|
const ix::WebSocketHttpHeaders& headers,
|
||||||
@ -87,10 +89,11 @@ namespace ix
|
|||||||
else if (eventType == ix::CobraConnection_EventType_Authenticated)
|
else if (eventType == ix::CobraConnection_EventType_Authenticated)
|
||||||
{
|
{
|
||||||
spdlog::info("Subscriber authenticated");
|
spdlog::info("Subscriber authenticated");
|
||||||
|
spdlog::info("Subscribing to {} at position {}", channel, subscriptionPosition);
|
||||||
conn.subscribe(channel,
|
conn.subscribe(channel,
|
||||||
filter,
|
filter,
|
||||||
position,
|
subscriptionPosition,
|
||||||
[&jsonWriter, &quiet, &msgPerSeconds, &msgCount, &fluentd](
|
[&jsonWriter, &quiet, &msgPerSeconds, &msgCount, &fluentd, &subscriptionPosition](
|
||||||
const Json::Value& msg, const std::string& position) {
|
const Json::Value& msg, const std::string& position) {
|
||||||
if (!quiet)
|
if (!quiet)
|
||||||
{
|
{
|
||||||
@ -99,6 +102,8 @@ namespace ix
|
|||||||
|
|
||||||
msgPerSeconds++;
|
msgPerSeconds++;
|
||||||
msgCount++;
|
msgCount++;
|
||||||
|
|
||||||
|
subscriptionPosition = position;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else if (eventType == ix::CobraConnection_EventType_Subscribed)
|
else if (eventType == ix::CobraConnection_EventType_Subscribed)
|
||||||
|
Loading…
Reference in New Issue
Block a user