You need to enable JavaScript to run this app.
导航
事件
最近更新时间:2025.04.15 20:11:38首次发布时间:2023.04.24 11:11:46
我的收藏
有用
有用
无用
无用

IMEvent

类型: enum

IM SDK 事件名。

成员

属性描述
Error'error'内部抛出异常时触发
WebSocketConnected'websocket-connected'长链建联
WebSocketDisconnected'websocket-disconnected'长链断开
WebSocketReceiveUnexpectedFrame'websocket-receive-unexpected-frame'WebSocket 收到了非预期 Service 的 Frame,可能来自业务侧
ReceiveNewMessage'receive-new-message'通过混链补偿或长链推送收到新消息时触发(非 50000+ 新消息), 需要自己的消息也触发时启用 noticeSelfMessage
ReceiveSelfMessage'receive-self-message'收到自己发送的消息
ReceiveCommandMessage'receive-command-message'收到命令消息
ReceiveNewUpdateExtMessage'receive-new-update-ext-message'收到 50002 消息时触发, 代表消息的 Ext 已经更改
消息被撤回, 被删除等也会触发这个事件
ReceiveNewP2PMessage'receive-new-p2p-message'收到自定义透传消息
MessageUpsert'message-upsert'在消息更新时触发
ConversationChange'conversation-change'在会话, 或会话内的消息发生变更时触发
ConversationUpsert'conversation-upsert'在会话更新时触发
ConversationDissolve'conversation-dissolve'在会话解散时触发
ConversationClearMessage'conversation-clear-message'在会话消息被清空时触发(v1.20.0 新增)
ConversationBlock'conversation-block'50011 全群禁言
ParticipantUpsert'participant-upsert'群成员变更
ParticipantJoin'participant-join'成员进群
ParticipantLeave'participant-leave'成员离开群聊,主动退群或者被踢出群聊,包括自己
ParticipantBlock'participant-block'会话内成员被禁言
MessageSend'message-send'消息发送
MessageRecall'message-recall'消息被撤回
MessageDelete'message-delete'消息被删除
ConversationDelete'conversation-delete'删除会话
ConversationLeave'conversation-leave'离开会话 自己退群或者被踢出群聊
ConversationCreate'conversation-create'创建会话
ConversationJoin'conversation-join'加入会话 进群
MessagePropertyUpsert'message-property-upsert'消息属性变更
BotContextClear'bot-context-clear'AI机器人会话上下文变更
InitLoadPage'init-load-page'初始化拉取历史消息,分页
InitFinish'init-finish'初始化成功完成
TokenExpired'token-expired'接口响应 Token 过期
ConversationOwnerChange'conversation-owner-change'群主变更(用于直播群),v1.1.0 新增
FriendApply'friend-apply'发起/收到好友申请
FriendDelete'friend-delete'删除好友
FriendAdd'friend-add'添加好友
FriendApplyRefuse'friend-apply-refuse'好友请求被拒绝
FriendApplyRead'friend-apply-read'好友请求已读(用于多端同步好友请求未读数)
FriendApplyUpdate'friend-apply-update'好友申请更新
FriendUpdate'friend-update'好友信息更新
BlacklistAdd'blacklist-add'黑名单添加新条目
BlacklistRemove'blacklist-remove'黑名单移除条目
BlacklistUpdate'blacklist-update'黑名单条目更新
ProfileUpdate'profile-update'用户资料更新(自己或好友)
LiveGroupMarkTypeUpdate'live-group-mark-type-update'直播群含有的标记类型更新
MessageRead'message-read'收到对端标记单条消息已读(v1.11.0 新增)
ConversationMessageRead'conversation-message-read'收到对端标记整个会话消息已读(v1.11.0 新增)

IMEventTypeMap

SDK 事件对应的回调参数,参见 IMEvent

类型

{
    [IMEvent.Error]: BaseError;
    [IMEvent.WebSocketConnected]: IMWebSocket;
    [IMEvent.WebSocketDisconnected]: IMWebSocket;
    [IMEvent.WebSocketReceiveUnexpectedFrame]: im_proto.IFrame;
    [IMEvent.ReceiveNewMessage]: Message;
    [IMEvent.ReceiveNewUpdateExtMessage]: Message;
    [IMEvent.ReceiveSelfMessage]: Message;
    [IMEvent.ReceiveNewP2PMessage]: P2PMessage<any>;
    [IMEvent.ReceiveCommandMessage]: CommandMessage<BaseCommandContentType>;
    [IMEvent.ConversationChange]: never;
    [IMEvent.ConversationUpsert]: Conversation;
    [IMEvent.ConversationDissolve]: Conversation;
    [IMEvent.ConversationDelete]: Conversation;
    [IMEvent.ConversationJoin]: Conversation;
    [IMEvent.ConversationLeave]: Conversation;
    [IMEvent.ConversationCreate]: Conversation;
    [IMEvent.ConversationBlock]: Conversation;
    [IMEvent.BotContextClear]: Message;
    [IMEvent.ParticipantUpsert]: Participant;
    [IMEvent.ParticipantJoin]: {
        participants: Participant[];
        onlineMemberCount?: number;
    };
    [IMEvent.ParticipantLeave]: {
        participants: Participant[];
        onlineMemberCount?: number;
        operatorType?: ParticipantLeaveOperatorType;
    };
    [IMEvent.ParticipantBlock]: Participant;
    [IMEvent.MessageUpsert]: Message;
    [IMEvent.MessageSend]: Message;
    [IMEvent.MessageDelete]: Message;
    [IMEvent.MessageRecall]: Message;
    [IMEvent.MessagePropertyUpsert]: Message;
    [IMEvent.InitLoadPage]: never;
    [IMEvent.InitFinish]: InitResult;
    [IMEvent.TokenExpired]: string;
    [IMEvent.ConversationOwnerChange]: {
        oldOwnerId: string;
        newOwnerId: string;
    };
    [IMEvent.FriendApply]: FriendApplyEventContent;
    [IMEvent.FriendDelete]: FriendDeleteEventContent;
    [IMEvent.FriendAdd]: FriendAddEventContent;
    [IMEvent.FriendApplyRefuse]: FriendApplyRefuseEventContent;
    [IMEvent.FriendApplyRead]: FriendApplyReadEventContent;
    [IMEvent.FriendApplyUpdate]: FriendApplyUpdateEventContent;
    [IMEvent.FriendUpdate]: FriendUpdateEventContent;
    [IMEvent.BlacklistAdd]: BlacklistAddEventContent;
    [IMEvent.BlacklistRemove]: BlacklistRemoveEventContent;
    [IMEvent.BlacklistUpdate]: BlacklistUpdateEventContent;
    [IMEvent.ProfileUpdate]: ProfileUpdateEventContent;
    [IMEvent.LiveGroupMarkTypeUpdate]: LiveGroupMarkTypeUpdateEventContent;
    [IMEvent.MessageRead]: P2PMessage<MessageReadEventContent>;
    [IMEvent.ConversationMessageRead]: P2PMessage<ConversationMessageReadEventContent>;
    [IMEvent.ConversationClearMessage]: ConversationClearMessageEventContent;
}