interface ChatroomListener {
    onAdminAdded?: ((roomId: string, adminId: string) => void);
    onAdminRemoved?: ((roomId: string, adminId: string) => void);
    onAllMemberMuteStateChanged?: ((roomId: string, isMuted: boolean) => void);
    onAnnouncementChanged?: ((roomId: string, announcement: string) => void);
    onAttributesRemoved?: ((roomId: string, keys: string[], from: string) => void);
    onAttributesUpdate?: ((roomId: string, attributeMap: Map<string, string>, from: string) => void);
    onMemberExited?: ((roomId: string, roomName: string, userId: string) => void);
    onMemberJoined?: ((roomId: string, userId: string) => void);
    onMutelistAdded?: ((roomId: string, mutes: string[], expireTime: number) => void);
    onMutelistRemoved?: ((roomId: string, mutes: string[]) => void);
    onOwnerChanged?: ((roomId: string, newOwner: string, oldOwner: string) => void);
    onRemovedFromChatroom?: ((reason: LEAVE_REASON, roomId: string, roomName: string) => void);
    onSpecificationChanged?: ((room: Chatroom) => void);
    onWhitelistAdded?: ((roomId: string, whitelist: string[]) => void);
    onWhitelistRemoved?: ((roomId: string, whitelist: string[]) => void);
}

Properties

onAdminAdded?: ((roomId: string, adminId: string) => void)

有成员被设置为管理员。

所有成员会收到此通知。

Type declaration

    • (roomId, adminId): void
    • Parameters

      • roomId: string

        聊天室 ID。

      • adminId: string

        被设置为管理员的成员。

      Returns void

onAdminRemoved?: ((roomId: string, adminId: string) => void)

有成员被移出管理员列表。

所有成员会收到此通知。

Type declaration

    • (roomId, adminId): void
    • Parameters

      • roomId: string

        聊天室 ID。

      • adminId: string

        被移出管理员列表的成员。

      Returns void

onAllMemberMuteStateChanged?: ((roomId: string, isMuted: boolean) => void)

全员禁言状态有变更。

聊天室所有成员会收到该事件。

Type declaration

    • (roomId, isMuted): void
    • Parameters

      • roomId: string

        聊天室 ID。

      • isMuted: boolean

        是否开启了全员禁言:

        • true:是;
        • false:否。

      Returns void

onAnnouncementChanged?: ((roomId: string, announcement: string) => void)

聊天室公告变更。

聊天室所有成员会收到该事件。

Type declaration

    • (roomId, announcement): void
    • Parameters

      • roomId: string

        聊天室 ID。

      • announcement: string

        更新的公告内容。

      Returns void

onAttributesRemoved?: ((roomId: string, keys: string[], from: string) => void)

聊天室自定义属性被移除。

聊天室所有成员会收到该事件。

Type declaration

    • (roomId, keys, from): void
    • Parameters

      • roomId: string

        聊天室 ID。

      • keys: string[]

        聊天室自定义属性 key 列表。

      • from: string

        操作者用户 ID。

      Returns void

onAttributesUpdate?: ((roomId: string, attributeMap: Map<string, string>, from: string) => void)

聊天室自定义属性(key-value)有更新。

聊天室所有成员会收到该事件。

Type declaration

    • (roomId, attributeMap, from): void
    • Parameters

      • roomId: string

        聊天室 ID。

      • attributeMap: Map<string, string>

        聊天室自定义属性。

      • from: string

        操作者的用户 ID。

      Returns void

onMemberExited?: ((roomId: string, roomName: string, userId: string) => void)

有新成员退出聊天室。

聊天室的所有成员会收到该事件。

Type declaration

    • (roomId, roomName, userId): void
    • Parameters

      • roomId: string

        聊天室 ID。

      • roomName: string

        聊天室名称。

      • userId: string

        退出的成员。

      Returns void

onMemberJoined?: ((roomId: string, userId: string) => void)

有新成员加入聊天室。

聊天室的所有成员会收到该事件

Type declaration

    • (roomId, userId): void
    • Parameters

      • roomId: string

        聊天室 ID。

      • userId: string

        新成员。

      Returns void

onMutelistAdded?: ((roomId: string, mutes: string[], expireTime: number) => void)

有成员被禁言。

被添加的成员收到该事件。禁言期间成员不能发送发消息。

Type declaration

    • (roomId, mutes, expireTime): void
    • Parameters

      • roomId: string

        聊天室 ID。

      • mutes: string[]

        被禁言的成员。

      • expireTime: number

      Returns void

onMutelistRemoved?: ((roomId: string, mutes: string[]) => void)

有成员从禁言列表中移除。

被解除禁言的成员会收到该事件。

Type declaration

    • (roomId, mutes): void
    • Parameters

      • roomId: string

        聊天室 ID。

      • mutes: string[]

        被解除禁言的成员。

      Returns void

onOwnerChanged?: ((roomId: string, newOwner: string, oldOwner: string) => void)

聊天室所有者变更。

聊天室所有成员会收到该事件

Type declaration

    • (roomId, newOwner, oldOwner): void
    • Parameters

      • roomId: string

        聊天室 ID。

      • newOwner: string

        新的聊天室所有者。

      • oldOwner: string

        原聊天室所有者。

      Returns void

onRemovedFromChatroom?: ((reason: LEAVE_REASON, roomId: string, roomName: string) => void)

有成员被移出聊天室。

被移出的成员收到该事件。

Type declaration

    • (reason, roomId, roomName): void
    • Parameters

      • reason: LEAVE_REASON

        : BE_KICK - 当前用户被移出聊天室, ROOM_DESTROYED - 聊天室被销毁,所有成员都会收到此通知 BE_KICKED_FOR_OFFLINE - 当前用户因为离线超过一定时间(默认2分钟)被移出聊天室

      • roomId: string

        聊天室 ID。

      • roomName: string

        聊天室名称。

      Returns void

onSpecificationChanged?: ((room: Chatroom) => void)

聊天室信息有更新。

聊天室所有成员会收到该事件。

Type declaration

    • (room): void
    • Parameters

      Returns void

onWhitelistAdded?: ((roomId: string, whitelist: string[]) => void)

有成员被加入白名单。

被添加的成员收到该事件。

Type declaration

    • (roomId, whitelist): void
    • Parameters

      • roomId: string

        聊天室 ID。

      • whitelist: string[]

        白名单中新增的成员名单。

      Returns void

onWhitelistRemoved?: ((roomId: string, whitelist: string[]) => void)

有成员被移出白名单。

被移出白名单的成员收到该事件。

Type declaration

    • (roomId, whitelist): void
    • Parameters

      • roomId: string

        聊天室 ID。

      • whitelist: string[]

        移出白名单的成员。

      Returns void