34 LocalPerson(std::shared_ptr<interface::Channel> channel,
36 std::unique_ptr<ChunkMessengerInterface> messenger,
37 int keepalive_interval_sec,
38 int keepalive_interval_gap_sec,
39 std::unique_ptr<AnalyticsClientInterface> analytics_client);
42 ChunkMessengerInterface* Messenger()
const override;
44 AnalyticsClientInterface* AnalyticsClient()
const override;
47 std::shared_ptr<interface::Publication>
Publish(std::shared_ptr<LocalStream> stream,
50 const std::string& publication_id,
52 bool Unpublish(
const std::string& publication_id)
const override;
53 bool Unsubscribe(
const std::string& subscription_id)
const override;
55 void OnPublished(std::shared_ptr<interface::Publication> publication)
override;
56 void OnUnpublished(std::shared_ptr<interface::Publication> publication)
override;
57 void OnSubscribed(std::shared_ptr<interface::Subscription> subscription, std::shared_ptr<interface::RemoteMember> publisher)
override;
58 void OnUnsubscribed(std::shared_ptr<interface::Subscription> subscription, std::shared_ptr<interface::RemoteMember> publisher)
override;
59 void OnPublicationSubscribedByRemoteMember(std::shared_ptr<interface::Subscription> subscription,
60 std::shared_ptr<interface::RemoteMember> subscriber)
override;
61 void OnPublicationUnsubscribedByRemoteMember(std::shared_ptr<interface::Subscription> subscription,
62 std::shared_ptr<interface::RemoteMember> subscriber)
override;
63 void Dispose()
override;
67 std::vector<analytics::interface::AnalyticsClient::SubscriptionStats> GetSubscriptionStatsForAnalytics()
71 void UpdateMemberTtl(
const std::string& channel_id,
int keepalive_interval_sec);
73 using SubscriptionId = std::string;
74 using SubscriptionPair =
77 std::unique_ptr<ChunkMessengerInterface> messenger_;
78 std::mutex tmp_subscriptions_mtx_;
79 std::unordered_map<SubscriptionId, SubscriptionPair> tmp_subscriptions_;
80 int keepalive_interval_sec_;
81 int keepalive_interval_gap_sec_;
83 std::unique_ptr<AnalyticsClientInterface> analytics_client_;
85 std::mutex stream_mtx_;
87 std::mutex is_disposed_mtx_;
88 std::condition_variable is_disposed_cv_;
90 std::unique_ptr<std::thread> ttl_timer_thread_;