7#ifndef _NIM_SDK_CPP_SUBSCRIBE_EVENT_HELPER_H_
8#define _NIM_SDK_CPP_SUBSCRIBE_EVENT_HELPER_H_
69 , readonly_ttl_type(0)
70 , readonly_durable_(0)
71 , readonly_event_time_(0)
72 , readonly_client_type_(0) {}
101 auto values = ToJsonObject(use_to_send);
122 for (
int i = 0; i < (int)online_values.
size(); ++i) {
124 online_client_type_.
insert(client_type);
156 , subscribe_time_(0) {}
208 std::list<EventSubscribeData>& event_subscribe_list);
Represents a JSON value.
Definition: value.h:196
bool isMember(const char *key) const
Definition: json_value.cpp:1241
bool isArray() const
Definition: json_value.cpp:1386
bool isObject() const
Definition: json_value.cpp:1390
bool insert(ArrayIndex index, const Value &newValue)
Insert value in array at specific index
Definition: json_value.cpp:1154
ArrayIndex size() const
Number of values in array or object
Definition: json_value.cpp:885
bool ParseEventSubscribeDataList(const std::string &subscribe_list_json, std::list< EventSubscribeData > &event_subscribe_list)
解析事件订阅数据列表
Definition: nim_subscribe_event_helper.cpp:108
bool ParseJsonValue(const std::string &content, nim_cpp_wrapper_util::Json::Value &values)
解析JsonString
Definition: nim_json_util.cpp:70
bool ParseEventDataList(const std::string &event_list_json, std::list< EventData > &event_data_list)
解析批量事件数据
Definition: nim_subscribe_event_helper.cpp:72
bool ParseEventData(const std::string &event_json, EventData &event_data)
解析事件数据
Definition: nim_subscribe_event_helper.cpp:11
bool ParseEventSubscribeData(const nim_cpp_wrapper_util::Json::Value &values, EventSubscribeData &event_subscribe)
解析事件订阅数据
Definition: nim_subscribe_event_helper.cpp:86
std::string GetJsonStringWithNoStyled(const nim_cpp_wrapper_util::Json::Value &values)
获得非格式化的Json string,传入SDK的json string格式要求为非格式化的,如果是格式化的json string可能会影响功能
Definition: nim_json_util.cpp:89
NIMClientType
Definition: nim_client_def.h:113
#define NIM_SDK_CPPWRAPPER_DLL_API
Definition: nim_sdk_cpp_wrapper.h:38
static const char * kNIMEventEventType
int,事件类型
Definition: nim_subscribe_event_def.h:20
static const char * kNIMEventSubscribeTTL
long,订阅有效期,单位:秒,范围:60s到30天
Definition: nim_subscribe_event_def.h:66
static const char * kNIMEventSubscribeSyncEvent
int,订阅后是否立即同步最新事件
Definition: nim_subscribe_event_def.h:68
static const char * kNIMEventTTL
long,事件有效期,单位:秒,时间范围:60s到7天
Definition: nim_subscribe_event_def.h:28
static const char * kNIMEventBroadcastType
int,事件广播类型:1:仅在线 2:在线和离线
Definition: nim_subscribe_event_def.h:30
static const char * kNIMEventMsgIdClient
string,客户端生成的消息id
Definition: nim_subscribe_event_def.h:24
NIMEventSyncType
Definition: nim_subscribe_event_def.h:87
@ kNIMEventSyncTypeNoSelf
事件不同步给自己其他端
Definition: nim_subscribe_event_def.h:89
static const char * kNIMEventNimConfigOnlineClient
string,预定义事件的扩展字段中的在线的客户端类型
Definition: nim_subscribe_event_def.h:57
static const char * kNIMEventMsgIdServer
string,服务端生成的消息id(客户端不填写)
Definition: nim_subscribe_event_def.h:40
static const char * kNIMEventSubscribeSubscribeTime
long,订阅时间戳(客户端不填写)
Definition: nim_subscribe_event_def.h:75
NIMEventBroadcastType
Definition: nim_subscribe_event_def.h:79
@ kNIMEventBroadcastTypeOnline
仅在线
Definition: nim_subscribe_event_def.h:81
static const char * kNIMEventMultiConfig
string,多端配置信息字段,JSON格式{"clent_type":"clent_config","1":"xxx","2":"xxx"}
Definition: nim_subscribe_event_def.h:46
static const char * kNIMEventClientType
int,发送客户端类型(客户端不填写)
Definition: nim_subscribe_event_def.h:42
static const char * kNIMEventEventValue
int,事件值
Definition: nim_subscribe_event_def.h:22
static const char * kNIMEventDurable
int,是否需要持久化(可选字段),默认为需要持久化,0:不需要持久化,1:需要持久化(客户端不填写)
Definition: nim_subscribe_event_def.h:36
NIMEventSubscribeSyncEventType
Definition: nim_subscribe_event_def.h:95
@ kNIMEventSubscribeSyncTypeUnSync
订阅后不同步最新事件
Definition: nim_subscribe_event_def.h:97
static const char * kNIMEventSubscribeSubscribeAccid
string,订阅人的accid(客户端不填写)
Definition: nim_subscribe_event_def.h:73
static const char * kNIMEventSubscribePublisherAccid
string,被订阅人(事件发布人)的accid(客户端不填写)
Definition: nim_subscribe_event_def.h:71
static const char * kNIMEventPublisherAccid
string,事件发布者的accid(客户端不填写)
Definition: nim_subscribe_event_def.h:48
static const char * kNIMEventNimConfig
string,预定义事件的扩展字段(在线状态事件:在线的客户端类型Json
Definition: nim_subscribe_event_def.h:44
static const char * kNIMEventSyncSelf
int,0:不同步给自己的其他端,1:同步给自己的其他端
Definition: nim_subscribe_event_def.h:32
static const char * kNIMEventTTLType
int,TtlType枚举值(客户端不填写)
Definition: nim_subscribe_event_def.h:34
static const char * kNIMEventSubscribeEventType
int,事件类型
Definition: nim_subscribe_event_def.h:64
static const char * kNIMEventConfig
string,用户自定义事件扩展属性,最长4K
Definition: nim_subscribe_event_def.h:26
static const char * kNIMEventEventTime
long,事件发布的时间戳,服务器补充(客户端不填写)
Definition: nim_subscribe_event_def.h:38
static const char * kNIMEventConsid
string,发送设备id(客户端不填写)
Definition: nim_subscribe_event_def.h:50
事件数据
Definition: nim_subscribe_event_helper.h:24
NIMEventBroadcastType broadcast_type_
事件广播类型
Definition: nim_subscribe_event_helper.h:36
std::string readonly_multi_config_
多端配置信息字段,JSON格式{"clent_type":"clent_config","1":"xxx","2":"xxx"}
Definition: nim_subscribe_event_helper.h:54
std::string config_
用户自定义事件扩展属性,最长4K
Definition: nim_subscribe_event_helper.h:32
int64_t readonly_event_time_
事件发布的时间戳,服务器补充
Definition: nim_subscribe_event_helper.h:46
EventData()
Definition: nim_subscribe_event_helper.h:63
int event_value_
事件状态,在线状态事件服务器保留1~9999的事件值,客户端自定义事件值需大于9999
Definition: nim_subscribe_event_helper.h:28
std::string readonly_server_msg_id_
服务端生成的消息id
Definition: nim_subscribe_event_helper.h:48
nim_cpp_wrapper_util::Json::Value ToJsonObject(bool use_to_send=true) const
Definition: nim_subscribe_event_helper.h:73
std::string client_msg_id_
客户端生成的消息id
Definition: nim_subscribe_event_helper.h:30
int event_type_
事件类型,服务器保留1~99999的事件类型,客户端自定义事件类型需大于99999
Definition: nim_subscribe_event_helper.h:26
int64_t ttl_
事件有效期,单位:秒,时间范围:60s到7天
Definition: nim_subscribe_event_helper.h:34
std::string readonly_nim_config_
预定义事件的扩展字段(在线状态事件:在线的客户端类型Json)
Definition: nim_subscribe_event_helper.h:52
int readonly_client_type_
发送客户端类型
Definition: nim_subscribe_event_helper.h:50
std::string readonly_consid_
发送设备id
Definition: nim_subscribe_event_helper.h:60
int readonly_durable_
是否需要持久化(可选字段),默认为需要持久化,0:不需要持久化,1:需要持久化
Definition: nim_subscribe_event_helper.h:44
std::string ToJsonString(bool use_to_send=true) const
组装Json Value字符串
Definition: nim_subscribe_event_helper.h:100
int readonly_ttl_type
TtlType枚举值
Definition: nim_subscribe_event_helper.h:42
NIMEventSyncType sync_self_
事件同步类型
Definition: nim_subscribe_event_helper.h:38
std::string readonly_publisher_accid_
事件发布者的accid
Definition: nim_subscribe_event_helper.h:58
在线客户端类型,此结构体只用于在线状态事件的kNIMEventNimConfig字段
Definition: nim_subscribe_event_helper.h:107
std::set< NIMClientType > online_client_type_
在线客户端类型集合
Definition: nim_subscribe_event_helper.h:109
bool ParseConfig(const std::string &multi_config_json)
针对在线状态事件,从kNIMEventNimConfig的Json Value解析出在线客户端类型
Definition: nim_subscribe_event_helper.h:116
事件订阅数据
Definition: nim_subscribe_event_helper.h:137
EventSubscribeData()
Definition: nim_subscribe_event_helper.h:152
int event_type_
事件类型
Definition: nim_subscribe_event_helper.h:139
nim_cpp_wrapper_util::Json::Value ToJsonObject() const
Definition: nim_subscribe_event_helper.h:157
std::string publisher_accid_
被订阅人(事件发布人)的accid
Definition: nim_subscribe_event_helper.h:146
std::string subscribe_accid_
订阅人的accid
Definition: nim_subscribe_event_helper.h:148
int64_t subscribe_time_
订阅时间戳
Definition: nim_subscribe_event_helper.h:150
int64_t ttl_
订阅有效期,单位:秒,范围:60s到30天
Definition: nim_subscribe_event_helper.h:141
NIMEventSubscribeSyncEventType sync_event_
订阅的事件的同步类型
Definition: nim_subscribe_event_helper.h:143