NIM PC Cross Platform SDK
载入中...
搜索中...
未找到
nim_subscribe_event_def.h 文件参考

事件订阅 接口相关的常量函数等定义头文件 更多...

#include "public_defines.h"

浏览源代码.

类型定义

typedef void(* nim_push_event_cb_func) (int res_code, const char *event_info_json, const char *json_extension, const void *user_data)
 
typedef void(* nim_batch_push_event_cb_func) (int res_code, const char *event_list_json, const char *json_extension, const void *user_data)
 
typedef void(* nim_publish_event_cb_func) (int res_code, int event_type, const char *event_info_json, const char *json_extension, const void *user_data)
 
typedef void(* nim_subscribe_event_cb_func) (int res_code, int event_type, const char *faild_list_json, const char *json_extension, const void *user_data)
 
typedef void(* nim_unsubscribe_event_cb_func) (int res_code, int event_type, const char *faild_list_json, const char *json_extension, const void *user_data)
 
typedef void(* nim_batch_unsubscribe_event_cb_func) (int res_code, int event_type, const char *json_extension, const void *user_data)
 
typedef void(* nim_query_subscribe_event_cb_func) (int res_code, int event_type, const char *subscribe_list_json, const char *json_extension, const void *user_data)
 
typedef void(* nim_batch_query_subscribe_event_cb_func) (int res_code, int event_type, const char *subscribe_list_json, const char *json_extension, const void *user_data)
 

枚举

enum  NIMEventBroadcastType { kNIMEventBroadcastTypeOnline = 1 , kNIMEventBroadcastTypeAll = 2 }
 
enum  NIMEventSyncType { kNIMEventSyncTypeNoSelf = 0 , kNIMEventSyncTypeSelf = 1 }
 
enum  NIMEventSubscribeSyncEventType { kNIMEventSubscribeSyncTypeUnSync = 0 , kNIMEventSubscribeSyncTypeSync = 1 }
 
enum  NIMEventType { kNIMEventTypeOnlineState = 1 , kNIMEventTypeSyncEvent = 2 , kNIMEventTypeCustom = 100000 }
 
enum  NIMEventOnlineStateValue {
  kNIMEventOnlineStateValueLogin = 1 , kNIMEventOnlineStateValueLogout = 2 , kNIMEventOnlineStateValueDisconnect = 3 , kNIMEventOnlineStateValueCustom = 10000 ,
  kNIMEventOnlineStateValueUpdateConfig = kNIMEventOnlineStateValueCustom + 1
}
 

变量

事件信息 Json Keys
static const char * kNIMEventEventType = "event_type"
 int,事件类型
 
static const char * kNIMEventEventValue = "event_value"
 int,事件值
 
static const char * kNIMEventMsgIdClient = "msgid_client"
 string,客户端生成的消息id
 
static const char * kNIMEventConfig = "config"
 string,用户自定义事件扩展属性,最长4K
 
static const char * kNIMEventTTL = "ttl"
 long,事件有效期,单位:秒,时间范围:60s到7天
 
static const char * kNIMEventBroadcastType = "broadcast_type"
 int,事件广播类型:1:仅在线 2:在线和离线
 
static const char * kNIMEventSyncSelf = "sync_seft"
 int,0:不同步给自己的其他端,1:同步给自己的其他端
 
static const char * kNIMEventTTLType = "ttltype"
 int,TtlType枚举值(客户端不填写)
 
static const char * kNIMEventDurable = "durable"
 int,是否需要持久化(可选字段),默认为需要持久化,0:不需要持久化,1:需要持久化(客户端不填写)
 
static const char * kNIMEventEventTime = "event_time"
 long,事件发布的时间戳,服务器补充(客户端不填写)
 
static const char * kNIMEventMsgIdServer = "msgid_server"
 string,服务端生成的消息id(客户端不填写)
 
static const char * kNIMEventClientType = "client_type"
 int,发送客户端类型(客户端不填写)
 
static const char * kNIMEventNimConfig = "nim_config"
 string,预定义事件的扩展字段(在线状态事件:在线的客户端类型Json
 
static const char * kNIMEventMultiConfig = "multi_config"
 string,多端配置信息字段,JSON格式{"clent_type":"clent_config","1":"xxx","2":"xxx"}
 
static const char * kNIMEventPublisherAccid = "publisher_accid"
 string,事件发布者的accid(客户端不填写)
 
static const char * kNIMEventConsid = "consid"
 string,发送设备id(客户端不填写)
 
在线状态事件kNIMEventNimConfig字段Json Keys,只用于在线状态事件
static const char * kNIMEventNimConfigOnlineClient = "online"
 string,预定义事件的扩展字段中的在线的客户端类型
 
事件订阅信息 Json Keys
static const char * kNIMEventSubscribeEventType = "type"
 int,事件类型
 
static const char * kNIMEventSubscribeTTL = "ttl"
 long,订阅有效期,单位:秒,范围:60s到30天
 
static const char * kNIMEventSubscribeSyncEvent = "syncevent"
 int,订阅后是否立即同步最新事件
 
static const char * kNIMEventSubscribePublisherAccid = "publisher_accid"
 string,被订阅人(事件发布人)的accid(客户端不填写)
 
static const char * kNIMEventSubscribeSubscribeAccid = "subscribe_accid"
 string,订阅人的accid(客户端不填写)
 
static const char * kNIMEventSubscribeSubscribeTime = "subscribe_time"
 long,订阅时间戳(客户端不填写)
 

详细描述

事件订阅 接口相关的常量函数等定义头文件

作者
Redrain
日期
2017/03/23

类型定义说明

◆ nim_batch_push_event_cb_func

void(* nim_batch_push_event_cb_func)(int res_code, const char *event_list_json, const char *json_extension, const void *user_data)

批量接收订阅的事件的回调函数定义

参数
[out]res_code结果代码,一切正常200
[out]event_list_json事件信息数组的json字符串
[out]json_extensionjson扩展数据(备用)
[out]user_dataAPP的自定义用户数据,SDK只负责传回给回调函数,不做任何处理!
返回
void 无返回值

◆ nim_batch_query_subscribe_event_cb_func

void(* nim_batch_query_subscribe_event_cb_func)(int res_code, int event_type, const char *subscribe_list_json, const char *json_extension, const void *user_data)

查询指定事件的全部订阅关系的回调函数定义

参数
[out]res_code结果代码,一切正常200
[out]event_type查询的事件类型
[out]subscribe_list_json订阅关系信息数组
[out]json_extensionjson扩展数据(备用)
[out]user_dataAPP的自定义用户数据,SDK只负责传回给回调函数,不做任何处理!
返回
void 无返回值

◆ nim_batch_unsubscribe_event_cb_func

void(* nim_batch_unsubscribe_event_cb_func)(int res_code, int event_type, const char *json_extension, const void *user_data)

取消指定事件的全部订阅关系的回调函数定义

参数
[out]res_code结果代码,一切正常200
[out]event_type取消的事件类型
[out]json_extensionjson扩展数据(备用)
[out]user_dataAPP的自定义用户数据,SDK只负责传回给回调函数,不做任何处理!
返回
void 无返回值

◆ nim_publish_event_cb_func

void(* nim_publish_event_cb_func)(int res_code, int event_type, const char *event_info_json, const char *json_extension, const void *user_data)

发布事件的回调函数定义

参数
[out]res_code结果代码,一切正常200
[out]event_type发布的事件类型
[out]event_info_json发布的事件信息
[out]json_extensionjson扩展数据(备用)
[out]user_dataAPP的自定义用户数据,SDK只负责传回给回调函数,不做任何处理!
返回
void 无返回值

◆ nim_push_event_cb_func

void(* nim_push_event_cb_func)(int res_code, const char *event_info_json, const char *json_extension, const void *user_data)

接收订阅的事件的回调函数定义

参数
[out]res_code结果代码,一切正常200
[out]event_info_json事件信息的json字符串
[out]json_extensionjson扩展数据(备用)
[out]user_dataAPP的自定义用户数据,SDK只负责传回给回调函数,不做任何处理!
返回
void 无返回值

◆ nim_query_subscribe_event_cb_func

void(* nim_query_subscribe_event_cb_func)(int res_code, int event_type, const char *subscribe_list_json, const char *json_extension, const void *user_data)

按帐号查询指定事件的订阅关系的回调函数定义

参数
[out]res_code结果代码,一切正常200
[out]event_type查询的事件类型
[out]subscribe_list_json订阅关系信息数组
[out]json_extensionjson扩展数据(备用)
[out]user_dataAPP的自定义用户数据,SDK只负责传回给回调函数,不做任何处理!
返回
void 无返回值

◆ nim_subscribe_event_cb_func

void(* nim_subscribe_event_cb_func)(int res_code, int event_type, const char *faild_list_json, const char *json_extension, const void *user_data)

订阅事件的回调函数定义

参数
[out]res_code结果代码,一切正常200
[out]event_type订阅的事件类型
[out]faild_list_json订阅失败的帐号数组
[out]json_extensionjson扩展数据(备用)
[out]user_dataAPP的自定义用户数据,SDK只负责传回给回调函数,不做任何处理!
返回
void 无返回值

◆ nim_unsubscribe_event_cb_func

void(* nim_unsubscribe_event_cb_func)(int res_code, int event_type, const char *faild_list_json, const char *json_extension, const void *user_data)

按账号取消指定事件的订阅关系的回调函数定义

参数
[out]res_code结果代码,一切正常200
[out]event_type取消订阅的事件类型
[out]faild_list_json取消订阅失败的帐号数组
[out]json_extensionjson扩展数据(备用)
[out]user_dataAPP的自定义用户数据,SDK只负责传回给回调函数,不做任何处理!
返回
void 无返回值

枚举类型说明

◆ NIMEventBroadcastType

事件广播类型

枚举值
kNIMEventBroadcastTypeOnline 

仅在线

kNIMEventBroadcastTypeAll 

在线和离线

◆ NIMEventOnlineStateValue

在线状态事件值

枚举值
kNIMEventOnlineStateValueLogin 

登录

kNIMEventOnlineStateValueLogout 

登出

kNIMEventOnlineStateValueDisconnect 

断开连接

kNIMEventOnlineStateValueCustom 

在线状态事件服务器保留1~9999的事件值,客户端自定义事件值需大于9999

kNIMEventOnlineStateValueUpdateConfig 

自己的其他端更新了自己端的multi_config信息

◆ NIMEventSubscribeSyncEventType

订阅的事件的同步类型

枚举值
kNIMEventSubscribeSyncTypeUnSync 

订阅后不同步最新事件

kNIMEventSubscribeSyncTypeSync 

订阅后立即同步最新事件

◆ NIMEventSyncType

事件同步类型

枚举值
kNIMEventSyncTypeNoSelf 

事件不同步给自己其他端

kNIMEventSyncTypeSelf 

事件同步给自己其他端

◆ NIMEventType

服务器预定义的事件类型

枚举值
kNIMEventTypeOnlineState 

在线状态事件(客户端可发送)

kNIMEventTypeSyncEvent 

同步“订阅事件”事件(客户端不可发送)

kNIMEventTypeCustom 

服务器保留1~99999的事件类型,客户端自定义事件类型需大于99999

变量说明

◆ kNIMEventBroadcastType

const char* kNIMEventBroadcastType = "broadcast_type"
static

int,事件广播类型:1:仅在线 2:在线和离线

◆ kNIMEventClientType

const char* kNIMEventClientType = "client_type"
static

int,发送客户端类型(客户端不填写)

◆ kNIMEventConfig

const char* kNIMEventConfig = "config"
static

string,用户自定义事件扩展属性,最长4K

◆ kNIMEventConsid

const char* kNIMEventConsid = "consid"
static

string,发送设备id(客户端不填写)

◆ kNIMEventDurable

const char* kNIMEventDurable = "durable"
static

int,是否需要持久化(可选字段),默认为需要持久化,0:不需要持久化,1:需要持久化(客户端不填写)

◆ kNIMEventEventTime

const char* kNIMEventEventTime = "event_time"
static

long,事件发布的时间戳,服务器补充(客户端不填写)

◆ kNIMEventEventType

const char* kNIMEventEventType = "event_type"
static

int,事件类型

◆ kNIMEventEventValue

const char* kNIMEventEventValue = "event_value"
static

int,事件值

◆ kNIMEventMsgIdClient

const char* kNIMEventMsgIdClient = "msgid_client"
static

string,客户端生成的消息id

◆ kNIMEventMsgIdServer

const char* kNIMEventMsgIdServer = "msgid_server"
static

string,服务端生成的消息id(客户端不填写)

◆ kNIMEventMultiConfig

const char* kNIMEventMultiConfig = "multi_config"
static

string,多端配置信息字段,JSON格式{"clent_type":"clent_config","1":"xxx","2":"xxx"}

◆ kNIMEventNimConfig

const char* kNIMEventNimConfig = "nim_config"
static

string,预定义事件的扩展字段(在线状态事件:在线的客户端类型Json

◆ kNIMEventNimConfigOnlineClient

const char* kNIMEventNimConfigOnlineClient = "online"
static

string,预定义事件的扩展字段中的在线的客户端类型

◆ kNIMEventPublisherAccid

const char* kNIMEventPublisherAccid = "publisher_accid"
static

string,事件发布者的accid(客户端不填写)

◆ kNIMEventSubscribeEventType

const char* kNIMEventSubscribeEventType = "type"
static

int,事件类型

◆ kNIMEventSubscribePublisherAccid

const char* kNIMEventSubscribePublisherAccid = "publisher_accid"
static

string,被订阅人(事件发布人)的accid(客户端不填写)

◆ kNIMEventSubscribeSubscribeAccid

const char* kNIMEventSubscribeSubscribeAccid = "subscribe_accid"
static

string,订阅人的accid(客户端不填写)

◆ kNIMEventSubscribeSubscribeTime

const char* kNIMEventSubscribeSubscribeTime = "subscribe_time"
static

long,订阅时间戳(客户端不填写)

◆ kNIMEventSubscribeSyncEvent

const char* kNIMEventSubscribeSyncEvent = "syncevent"
static

int,订阅后是否立即同步最新事件

◆ kNIMEventSubscribeTTL

const char* kNIMEventSubscribeTTL = "ttl"
static

long,订阅有效期,单位:秒,范围:60s到30天

◆ kNIMEventSyncSelf

const char* kNIMEventSyncSelf = "sync_seft"
static

int,0:不同步给自己的其他端,1:同步给自己的其他端

◆ kNIMEventTTL

const char* kNIMEventTTL = "ttl"
static

long,事件有效期,单位:秒,时间范围:60s到7天

◆ kNIMEventTTLType

const char* kNIMEventTTLType = "ttltype"
static

int,TtlType枚举值(客户端不填写)