NIM PC Cross Platform SDK
nim_cpp_subscribe_event.h
Go to the documentation of this file.
1
7#ifndef _NIM_SDK_CPP_SUBSCRIBE_EVENT_H_
8#define _NIM_SDK_CPP_SUBSCRIBE_EVENT_H_
9
10#include <functional>
11#include <list>
12#include <string>
15
20namespace nim {
24class NIM_SDK_CPPWRAPPER_DLL_API SubscribeEvent {
25public:
27 typedef std::function<void(NIMResCode res_code, const nim::EventData& event_data)> PushEventCallback;
28 typedef std::function<void(NIMResCode res_code, const std::list<nim::EventData>& event_list)>
31
33 typedef std::function<void(NIMResCode res_code, int event_type, const nim::EventData& event_data)> PublishEventCallback;
34 typedef std::function<void(NIMResCode res_code, int event_type, const std::list<std::string>& faild_list)>
37 typedef std::function<void(NIMResCode res_code, int event_type, const std::list<std::string>& faild_list)>
41 typedef std::function<void(NIMResCode res_code, int event_type)> BatchUnSubscribeEventCallback;
42 typedef std::function<void(NIMResCode res_code, int event_type, const std::list<nim::EventSubscribeData>& subscribe_list)>
45 typedef std::function<void(NIMResCode res_code, int event_type, const std::list<nim::EventSubscribeData>& subscribe_list)>
48
49public:
57 static void RegPushEventCb(const PushEventCallback& cb, const std::string& json_extension = "");
58
66 static void RegBatchPushEventCb(const BatchPushEventCallback& cb, const std::string& json_extension = "");
67
80 static bool Publish(const EventData& event_data, const PublishEventCallback& cb, const std::string& json_extension = "");
81
100 static bool Subscribe(int event_type,
101 int64_t ttl,
103 const std::list<std::string>& accid_list,
104 const SubscribeEventCallback& cb,
105 const std::string& json_extension = "");
106
121 static bool UnSubscribe(int event_type,
122 const std::list<std::string>& accid_list,
123 const UnSubscribeEventCallback& cb,
124 const std::string& json_extension = "");
125
136 static bool BatchUnSubscribe(int event_type, const BatchUnSubscribeEventCallback& cb, const std::string& json_extension = "");
137
152 static bool QuerySubscribe(int event_type,
153 const std::list<std::string>& accid_list,
155 const std::string& json_extension = "");
156};
157
158} // namespace nim
159
160#endif //_NIM_SDK_CPP_SUBSCRIBE_EVENT_H_
NIM 订阅事件相关接口
Definition: nim_cpp_subscribe_event.h:24
std::function< void(NIMResCode res_code, int event_type, const std::list< nim::EventSubscribeData > &subscribe_list)> BatchQuerySubscribeEventCallback
查询指定事件的全部订阅关系回调模板
Definition: nim_cpp_subscribe_event.h:47
std::function< void(NIMResCode res_code, int event_type, const std::list< nim::EventSubscribeData > &subscribe_list)> QuerySubscribeEventCallback
按帐号查询指定事件的订阅关系回调模板
Definition: nim_cpp_subscribe_event.h:44
std::function< void(NIMResCode res_code, const nim::EventData &event_data)> PushEventCallback
接收订阅事件回调模板
Definition: nim_cpp_subscribe_event.h:27
std::function< void(NIMResCode res_code, int event_type, const nim::EventData &event_data)> PublishEventCallback
发布事件回调模板
Definition: nim_cpp_subscribe_event.h:33
std::function< void(NIMResCode res_code, int event_type, const std::list< std::string > &faild_list)> UnSubscribeEventCallback
按账号取消指定事件的订阅关系回调模板
Definition: nim_cpp_subscribe_event.h:39
std::function< void(NIMResCode res_code, int event_type, const std::list< std::string > &faild_list)> SubscribeEventCallback
订阅事件回调模板
Definition: nim_cpp_subscribe_event.h:36
std::function< void(NIMResCode res_code, const std::list< nim::EventData > &event_list)> BatchPushEventCallback
批量接收订阅事件回调模板
Definition: nim_cpp_subscribe_event.h:30
std::function< void(NIMResCode res_code, int event_type)> BatchUnSubscribeEventCallback
取消指定事件的全部订阅关系回调模板
Definition: nim_cpp_subscribe_event.h:41
namespace nim
NIMResCode
Definition: nim_chatroom_res_code_def.h:15
定义导出宏
NIMEventSubscribeSyncEventType
Definition: nim_subscribe_event_def.h:95
事件订阅辅助方法和数据结构定义
事件数据
Definition: nim_subscribe_event_helper.h:24