Skip to content

Commit 2411bda

Browse files
committed
feat: add onIMClient{On,Off}line hooks
1 parent 74d1676 commit 2411bda

3 files changed

Lines changed: 7 additions & 1 deletion

File tree

API.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,8 @@ LeanEngine 中间件会为这些 Hook 函数检查「Hook 签名」,确保调
186186
* `AV.Cloud.onIMConversationAdd`
187187
* `AV.Cloud.onIMConversationRemove`
188188
* `AV.Cloud.onIMConversationUpdate`
189+
* `AV.Cloud.onIMClientOnline`
190+
* `AV.Cloud.onIMClientOffline`
189191

190192
LeanEngine 中间件会为这些 Hook 函数检查「Hook 签名」,确保调用者的确是 LeanCloud 或本地调试时的命令行工具。
191193

leanengine.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,8 @@ export namespace Cloud {
156156
export function onIMConversationAdd(handler: CloudFunction): void;
157157
export function onIMConversationRemove(handler: CloudFunction): void;
158158
export function onIMConversationUpdate(handler: CloudFunction): void;
159+
export function onIMClientOnline(handler: CloudFunction): void;
160+
export function onIMClientOffline(handler: CloudFunction): void;
159161

160162
export function LeanCloudHeaders(options?: MiddlewareOptions): RequestHandler;
161163
export function CookieSession(options?: CookieSessionOptions): RequestHandler;

lib/utils.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ exports.realtimeHookMapping = {
2121
onIMConversationStarted: '_conversationStarted',
2222
onIMConversationAdd: '_conversationAdd',
2323
onIMConversationRemove: '_conversationRemove',
24-
onIMConversationUpdate: '_conversationUpdate'
24+
onIMConversationUpdate: '_conversationUpdate',
25+
onIMClientOnline: '_clientOnline',
26+
onIMClientOffline: '_clientOffline'
2527
};
2628

2729
exports.unauthResp = function(res) {

0 commit comments

Comments
 (0)