30 LocalPerson(std::shared_ptr<interface::Channel> channel,
32 std::unique_ptr<ChunkMessengerInterface> messenger,
33 int keepalive_interval_sec,
34 int keepalive_interval_gap_sec,
35 std::unique_ptr<AnalyticsClientInterface> analytics_client);
38 ChunkMessengerInterface* Messenger()
const override;
40 AnalyticsClientInterface* AnalyticsClient()
const override;
43 std::shared_ptr<interface::Publication>
Publish(std::shared_ptr<LocalStream> stream,
46 const std::string& publication_id,
48 bool Unpublish(
const std::string& publication_id)
const override;
49 bool Unsubscribe(
const std::string& subscription_id)
const override;
51 void OnPublished(std::shared_ptr<interface::Publication> publication)
override;
52 void OnUnpublished(std::shared_ptr<interface::Publication> publication)
override;
53 void OnSubscribed(std::shared_ptr<interface::Subscription> subscription, std::shared_ptr<interface::RemoteMember> publisher)
override;
54 void OnUnsubscribed(std::shared_ptr<interface::Subscription> subscription, std::shared_ptr<interface::RemoteMember> publisher)
override;
55 void OnPublicationSubscribedByRemoteMember(std::shared_ptr<interface::Subscription> subscription,
56 std::shared_ptr<interface::RemoteMember> subscriber)
override;
57 void OnPublicationUnsubscribedByRemoteMember(std::shared_ptr<interface::Subscription> subscription,
58 std::shared_ptr<interface::RemoteMember> subscriber)
override;
59 void Dispose()
override;
63 std::vector<analytics::interface::AnalyticsClient::SubscriptionStats> GetSubscriptionStatsForAnalytics()
67 void UpdateMemberTtl(
const std::string& channel_id,
int keepalive_interval_sec);
69 using SubscriptionId = std::string;
70 using SubscriptionPair =
73 std::unique_ptr<ChunkMessengerInterface> messenger_;
74 std::mutex tmp_subscriptions_mtx_;
75 std::unordered_map<SubscriptionId, SubscriptionPair> tmp_subscriptions_;
76 int keepalive_interval_sec_;
77 int keepalive_interval_gap_sec_;
79 std::unique_ptr<AnalyticsClientInterface> analytics_client_;
81 std::mutex stream_mtx_;
83 std::mutex is_disposed_mtx_;
84 std::condition_variable is_disposed_cv_;
86 std::unique_ptr<std::thread> ttl_timer_thread_;