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) {}
107 if (online_values.isArray()) {
108 for (
int i = 0; i < (int)online_values.
size(); ++i) {
110 online_client_type_.
insert(client_type);
142 , subscribe_time_(0) {}
151NIM_SDK_CPPWRAPPER_DLL_API
bool ParseEventData(
const std::string& event_json, EventData& event_data);
167NIM_SDK_CPPWRAPPER_DLL_API
bool ParseEventDataList(
const std::string& event_list_json, std::list<EventData>& event_data_list);
184 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 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
static const char * kNIMEventEventType
int,事件类型
Definition: nim_subscribe_event_def.h:20
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
NIMEventBroadcastType
Definition: nim_subscribe_event_def.h:79
@ kNIMEventBroadcastTypeOnline
仅在线
Definition: nim_subscribe_event_def.h:81
static const char * kNIMEventEventValue
int,事件值
Definition: nim_subscribe_event_def.h:22
NIMEventSubscribeSyncEventType
Definition: nim_subscribe_event_def.h:95
@ kNIMEventSubscribeSyncTypeUnSync
订阅后不同步最新事件
Definition: nim_subscribe_event_def.h:97
static const char * kNIMEventSyncSelf
int,0:不同步给自己的其他端,1:同步给自己的其他端
Definition: nim_subscribe_event_def.h:32
static const char * kNIMEventConfig
string,用户自定义事件扩展属性,最长4K
Definition: nim_subscribe_event_def.h:26
事件数据
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
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
std::string ToJsonString() const
组装Json Value字符串
Definition: nim_subscribe_event_helper.h:78
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
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:93
std::set< NIMClientType > online_client_type_
在线客户端类型集合
Definition: nim_subscribe_event_helper.h:95
bool ParseConfig(const std::string &multi_config_json)
针对在线状态事件,从kNIMEventNimConfig的Json Value解析出在线客户端类型
Definition: nim_subscribe_event_helper.h:102
事件订阅数据
Definition: nim_subscribe_event_helper.h:123
EventSubscribeData()
Definition: nim_subscribe_event_helper.h:138
int event_type_
事件类型
Definition: nim_subscribe_event_helper.h:125
std::string publisher_accid_
被订阅人(事件发布人)的accid
Definition: nim_subscribe_event_helper.h:132
std::string subscribe_accid_
订阅人的accid
Definition: nim_subscribe_event_helper.h:134
int64_t subscribe_time_
订阅时间戳
Definition: nim_subscribe_event_helper.h:136
int64_t ttl_
订阅有效期,单位:秒,范围:60s到30天
Definition: nim_subscribe_event_helper.h:127
NIMEventSubscribeSyncEventType sync_event_
订阅的事件的同步类型
Definition: nim_subscribe_event_helper.h:129