Interface ChatRoomEventListener

The chat room event listener.

interface ChatRoomEventListener {
    onAdminAdded?(params: {
        admin: string;
        roomId: string;
    }): void;
    onAdminRemoved?(params: {
        admin: string;
        roomId: string;
    }): void;
    onAllChatRoomMemberMuteStateChanged?(params: {
        isAllMuted: boolean;
        roomId: string;
    }): void;
    onAllowListAdded?(params: {
        members: string[];
        roomId: string;
    }): void;
    onAllowListRemoved?(params: {
        members: string[];
        roomId: string;
    }): void;
    onAnnouncementChanged?(params: {
        announcement: string;
        roomId: string;
    }): void;
    onAttributesRemoved?(params: {
        from: string;
        removedKeys: string[];
        roomId: string;
    }): void;
    onAttributesUpdated?(params: {
        attributes: Map<string, string>;
        from: string;
        roomId: string;
    }): void;
    onDestroyed?(params: {
        roomId: string;
        roomName?: string;
    }): void;
    onMemberExited?(params: {
        participant: string;
        roomId: string;
        roomName?: string;
    }): void;
    onMemberJoined?(params: {
        participant: string;
        roomId: string;
    }): void;
    onMemberRemoved?(params: {
        participant?: string;
        reason?: string;
        roomId: string;
        roomName?: string;
    }): void;
    onMuteListAdded?(params: {
        expireTime?: string;
        mutes: string[];
        roomId: string;
    }): void;
    onMuteListRemoved?(params: {
        mutes: string[];
        roomId: string;
    }): void;
    onOwnerChanged?(params: {
        newOwner: string;
        oldOwner: string;
        roomId: string;
    }): void;
    onSpecificationChanged?(room: ChatRoom): void;
}

Methods

  • Occurs when a chat room member is set as an admin. The member set as the chat room admin receives this event.

    Parameters

    • params: {
          admin: string;
          roomId: string;
      }
      • admin: string
      • roomId: string

    Returns void

    The parameter set.

    • Param [roomId] The chat room ID.
    • Param [admin] The user ID of the member who is set as an admin.
  • Occurs when the chat room member(s) is/are removed from the admin list. The admin removed from the admin list receives this event.

    Parameters

    • params: {
          admin: string;
          roomId: string;
      }
      • admin: string
      • roomId: string

    Returns void

    The parameter set.

    • Param [roomId] The chat room ID.
    • Param [admin] The user ID of the admin whose administrative privileges are removed.
  • Occurs when all members in the chat room are muted or unmuted. All chat room members receive this event.

    Parameters

    • params: {
          isAllMuted: boolean;
          roomId: string;
      }
      • isAllMuted: boolean
      • roomId: string

    Returns void

    The parameter set.

    • Param [roomId] The chat room ID.
    • Param [isAllMuted] Whether all chat room members are muted.
      • true: Yes.
      • false: No.
  • Occurs when the chat room member(s) is/are added to the allow list. The members added to the allow list receive this event.

    Parameters

    • params: {
          members: string[];
          roomId: string;
      }
      • members: string[]
      • roomId: string

    Returns void

    The parameter set.

    • Param [roomId] The chat room ID.
    • Param [members] The member(s) added to the allow list of the chat room.
  • Occurs when the chat room member(s) is/are removed from the allow list. The members that are removed from the allow list receive this event.

    Parameters

    • params: {
          members: string[];
          roomId: string;
      }
      • members: string[]
      • roomId: string

    Returns void

    The parameter set.

    • Param [roomId] The chat room ID.
    • Param [members] The member(s) removed from the allow list of the chat room.
  • Occurs when the chat room announcement changes. All chat room members receive this event.

    Parameters

    • params: {
          announcement: string;
          roomId: string;
      }
      • announcement: string
      • roomId: string

    Returns void

    The parameter set.

    • Param [roomId] The chat room ID.
    • Param [announcement] The new announcement.
  • The custom chat room attribute(s) is/are removed. All chat room members receive this event.

    Parameters

    • params: {
          from: string;
          removedKeys: string[];
          roomId: string;
      }
      • from: string
      • removedKeys: string[]
      • roomId: string

    Returns void

    params

    • roomId: The chat room ID.
    • removedKeys: The key list of custom chat room attributes that are removed.
    • from: The user ID of the operator.
  • The custom chat room attribute(s) is/are updated. All chat room members receive this event.

    Parameters

    • params: {
          attributes: Map<string, string>;
          from: string;
          roomId: string;
      }
      • attributes: Map<string, string>
      • from: string
      • roomId: string

    Returns void

    params

    • roomId: The chat room ID.
    • attributes: The list of custom chat room attributes (key-value) that are updated.
    • from: The user ID of the operator.
  • Occurs when the chat room is destroyed. All chat room members receive this event.

    Parameters

    • params: {
          roomId: string;
          roomName?: string;
      }
      • roomId: string
      • OptionalroomName?: string

    Returns void

    The parameter set.

    • Param [roomId] The chat room ID.
    • Param [roomName] The name of the chat room.
  • Occurs when a member exits the chat room. All chat room members, except the member exiting the chat room, receive this event.

    Parameters

    • params: {
          participant: string;
          roomId: string;
          roomName?: string;
      }
      • participant: string
      • roomId: string
      • OptionalroomName?: string

    Returns void

    The parameter set.

    • Param [roomId] The chat room ID.
    • Param [participant] The user ID of the member who leaves the chat room.
  • Occurs when a member joins the chat room. All chat room members, except the new member, receive this event.

    Parameters

    • params: {
          participant: string;
          roomId: string;
      }
      • participant: string
      • roomId: string

    Returns void

    The parameter set.

    • Param [roomId] The chat room ID.
    • Param [participant] The user ID of the new member.
  • Occurs when a member is removed from a chat room. The member that is kicked out of the chat room receive this event.

    Parameters

    • params: {
          participant?: string;
          reason?: string;
          roomId: string;
          roomName?: string;
      }
      • Optionalparticipant?: string
      • Optionalreason?: string
      • roomId: string
      • OptionalroomName?: string

    Returns void

    The parameter set.

    • Param [roomId] The chat room ID.
    • Param [roomName] The name of the chat room.
    • Param [participant] The user ID of the member that is removed from a chat room.
    • Param [reason] Reason for removal.
  • Occurs when the chat room member(s) is/are added to the mute list. The muted members receive this event.

    Parameters

    • params: {
          expireTime?: string;
          mutes: string[];
          roomId: string;
      }
      • OptionalexpireTime?: string
      • mutes: string[]
      • roomId: string

    Returns void

    The parameter set.

    • Param [roomId] The chat room ID.
    • Param [mutes] The user ID(s) of muted member(s).
    • Param [expireTime] Reserved parameter. The Unix timestamp when the mute duration expires.
  • Occurs when the chat room member(s) is/are removed from the mute list. The members that are removed from the mute list receive this event.

    Parameters

    • params: {
          mutes: string[];
          roomId: string;
      }
      • mutes: string[]
      • roomId: string

    Returns void

    The parameter set.

    • Param [roomId] The chat room ID.
    • Param [mutes] The user ID(s) of unmuted member(s).
  • Occurs when the chat room owner is changed. The chat room owner receives this event.

    Parameters

    • params: {
          newOwner: string;
          oldOwner: string;
          roomId: string;
      }
      • newOwner: string
      • oldOwner: string
      • roomId: string

    Returns void

    The parameter set.

    • Param [roomId] The chat room ID.
    • Param [newOwner] The user ID of the new chat room owner.
    • Param [oldOwner] The user ID of the previous chat room owner.
  • Occurs when the chat room specifications changes. All chat room members receive this event.

    Parameters

    Returns void