通知服务
更多...
#include <v2_nim_notification_service.hpp>
通知服务
- 前置条件
- 调用
V2NIMClient::get()
拿到 client 实例 调用 client.getNotificationService()
拿到 notificationService 实例
- 示例代码
auto& notificationService = client.getNotificationService();
static V2NIMClient & get()
获取 IM 客户端实例
Definition: v2_nim_api.hpp:428
◆ addNotificationListener()
添加通知监听器
- 参数
-
- 返回
- void
- 示例代码
};
};
notificationService.addNotificationListener(listener);
Definition: ne_stl_continuous_container.h:15
Definition: v2_nim_def_callback.hpp:134
nstd::function< void(nstd::vector< V2NIMCustomNotification > customNotification)> onReceiveCustomNotifications
收到自定义
Definition: v2_nim_def_callback.hpp:136
nstd::function< void(nstd::vector< V2NIMBroadcastNotification > broadcastNotification)> onReceiveBroadcastNotifications
收到广播
Definition: v2_nim_def_callback.hpp:138
◆ removeNotificationListener()
移除通知监听器
- 参数
-
- 返回
- void
- 示例代码
conversationService.addNotificationListener(listener);
conversationService.removeNotificationListener(listener);
◆ sendCustomNotification()
发送自定义通知
- 参数
-
conversationId | 会话 ID |
content | 通知内容 |
params | 发送通知相关配置参数 |
success | 成功回调 |
failure | 失败回调 |
- 返回
- void
- 示例代码
notificationService.sendCustomNotification(
conversationId,
"hello world",
params,
[]() {
},
});
Definition: v2_nim_def_struct.hpp:7
Definition: v2_nim_def_struct.hpp:888
static nstd::string p2pConversationId(const nstd::string &accountId)
获取点对点会话ID
Definition: v2_nim_internal.hpp:246
该类的文档由以下文件生成: