Options
All
  • Public
  • Public/Protected
  • All
Menu

Chatroom contains APIs for chatroom-related operations.

Index

Functions

Const addUsersToChatRoomAllowlist

Const blockChatRoomMember

  • 添加单个成员至聊天室黑名单。该方法只有聊天室所有者和管理员才有权限调用。

    connection.blockChatRoomMember({chatRoomId: 'chatRoomId', username: 'user1'})
    

    Parameters

    Returns Promise<AsyncResult<CommonRequestResult>>

Const blockChatRoomMembers

  • 批量添加用户至聊天室黑名单。该方法只有聊天室所有者和管理员才有权限调用。

    connection.blockChatRoomMembers({usernames: ['user1', 'user2'], chatRoomId: 'chatRoomId'})
    

    Parameters

    Returns Promise<AsyncResult<CommonRequestResult[]>>

createChatRoom

  • createChatRoom(params: { description: string; maxusers: number; members: string[]; name: string; token: string; error?: any; success?: any }): Promise<AsyncResult<CreateChatRoomResult>>
  • 创建聊天室。

    connection.createChatRoom({name: 'myChatRoom', description: 'this is my chatroom', maxusers: 200, members; ['user1'], token: 'your token'})
    

    Parameters

    • params: { description: string; maxusers: number; members: string[]; name: string; token: string; error?: any; success?: any }
      • description: string

        聊天室描述。

      • maxusers: number

        聊天室最大成员数(包括聊天室创建者),值为数值类型,默认值 200,最大值 5,000。

      • members: string[]

        (可选)聊天室成员,由用户 ID 组成的数组。如果设置了该参数,请确保数组内至少包含一个用户。

      • name: string

        聊天室名称。

      • token: string

        超级管理员 token。

      • error?:function
      • success?:function

    Returns Promise<AsyncResult<CreateChatRoomResult>>

deleteChatRoomSharedFile

destroyChatRoom

disableSendChatRoomMsg

enableSendChatRoomMsg

fetchChatRoomAnnouncement

getChatRoomAdmin

Const getChatRoomAllowlist

  • getChatRoomAllowlist(params: { chatRoomId: string; error: any; success: any }): Promise<AsyncResult<UserId[]>>
  • 获取白聊天室白名单列表。仅聊天室所有者和管理员有权调用该方法。

    connection.getChatRoomWhitelist({chatRoomId: 'chatRoomId'})
    

    Parameters

    • params: { chatRoomId: string; error: any; success: any }
      • chatRoomId: string

        聊天室 ID。

      • error:function
      • success:function

    Returns Promise<AsyncResult<UserId[]>>

Const getChatRoomBlocklist

  • getChatRoomBlocklist(params: { chatRoomId: string; error?: any; success?: any }): Promise<AsyncResult<UserId[]>>
  • 获取聊天室黑名单。

    connection.getChatRoomBlocklist({chatRoomId: 'chatRoomId'})
    

    Parameters

    • params: { chatRoomId: string; error?: any; success?: any }
      • chatRoomId: string

        聊天室 ID。

      • error?:function
      • success?:function

    Returns Promise<AsyncResult<UserId[]>>

getChatRoomDetails

Const getChatRoomMutelist

Const getChatRoomSharedFilelist

getChatRooms

Const isInChatRoomAllowlist

  • 查询聊天室成员是否是在白名单中。仅聊天室所有者和管理员有权调用该方法。普通成员可查询自己。

    connection.isInChatRoomAllowlist({chatRoomId: 'chatRoomId', userName: 'user1'})
    

    Parameters

    Returns Promise<AsyncResult<IsChatRoomWhiteUserResult>>

joinChatRoom

  • 加入聊天室。用户成功加入聊天室后,其他成员会在 onChatroomEvent 回调里收到 operation:'memberPresence'。

    connection.joinChatRoom({roomId: 'roomId'})
    

    Parameters

    Returns Promise<AsyncResult<CommonRequestResult>>

Const leaveChatRoom

  • leaveChatRoom(params: { roomId: string; error?: any; success?: any }): Promise<AsyncResult<{ result: boolean }>>
  • 退出聊天室。若某成员退出聊天室,其他成员会在 onChatroomEvent 回调里收到 "operation: 'memberAbsence'"。

    connection.leaveChatRoom({roomId: 'roomId'})
    

    Parameters

    • params: { roomId: string; error?: any; success?: any }
      • roomId: string

        聊天室 ID。

      • error?:function
      • success?:function
        • Parameters

          Returns void

    Returns Promise<AsyncResult<{ result: boolean }>>

Const listChatRoomMembers

  • listChatRoomMembers(params: { chatRoomId: string; pageNum: number; pageSize: number; error?: any; success?: any }): Promise<AsyncResult<{ member: string }[]>>
  • 分页列出聊天室的所有成员。

    connection.listChatRoomMembers({pageNum: 1, pageSize: 20, chatRoomId: 'chatRoomId'})
    

    Parameters

    • params: { chatRoomId: string; pageNum: number; pageSize: number; error?: any; success?: any }
      • chatRoomId: string

        聊天室 ID。

      • pageNum: number

        当前页码,从 1 开始。

      • pageSize: number

        每页返回的成员数,最大值为 1,000。

      • error?:function
      • success?:function
        • Parameters

          Returns void

    Returns Promise<AsyncResult<{ member: string }[]>>

modifyChatRoom

  • modifyChatRoom(params: { chatRoomId: string; chatRoomName: string; description: string; maxusers: number; error?: any; success?: any }): Promise<AsyncResult<ModifyChatRoomResult>>
  • 修改聊天室详情。

    connection.modifyChatRoom({chatRoomId: 'chatRoomId', chatRoomName: 'chatRoomName', description: 'description', maxusers: 5000})
    

    Parameters

    • params: { chatRoomId: string; chatRoomName: string; description: string; maxusers: number; error?: any; success?: any }

    Returns Promise<AsyncResult<ModifyChatRoomResult>>

muteChatRoomMember

  • 禁止聊天室用户发言。该方法只有聊天室所有者才有权限调用。所有成员都会在 onChatroomEvent 的回调里收到 "operation:'muteMember'"。

    connection.muteChatRoomMember({username: 'user1', muteDuration: -1, chatRoomId: 'chatRoomId'})
    

    Parameters

    • params: { chatRoomId: string; muteDuration: number; username: string; error?: any; success?: any }

    Returns Promise<AsyncResult<MuteChatRoomMemberResult>>

removeChatRoomAdmin

  • 移除聊天室管理员。该方法只有聊天室所有者才有权限调用。被移除管理员权限的用户会在 onChatroomEvent 的回调里收到 operation: 'removeAdmin'。

    connection.removeChatRoomAdmin({chatRoomId: 'chatRoomId', username: 'user1'})
    

    Parameters

    Returns Promise<AsyncResult<RemoveChatRoomAdminResult>>

Const removeChatRoomAllowlistMember

  • removeChatRoomAllowlistMember(params: { chatRoomId: string; userName: string; error?: any; success?: any }): Promise<AsyncResult<CommonRequestResult>>
  • 移除聊天室白名单成员。仅聊天室所有者和管理员有权限调用该方法。被移出白名单的成员会在 onChatroomEvent 的回调里收到 "operation:'removeAllowlistMember'" 回调。

    connection.removeChatRoomAllowlistMember({chatRoomId: 'chatRoomId', userName: 'user1'})
    

    Parameters

    Returns Promise<AsyncResult<CommonRequestResult>>

Const removeChatRoomMember

setChatRoomAdmin

  • 设置聊天室管理员。该方法只有聊天室所有者才有权限调用。被设置成管理员的用户会在 onChatroomEvent 的回调里收到 "operation: 'setAdmin'"。

    connection.setChatRoomAdmin({chatRoomId: 'chatRoomId', username: 'user1'})
    

    Parameters

    Returns Promise<AsyncResult<SetChatRoomAdminResult>>

Const unblockChatRoomMember

  • 将单个成员从聊天室黑名单移除。该方法只有聊天室所有者和管理员才有权限调用。

    connection.unblockChatRoomMember({chatRoomId: 'chatRoomId', username: 'user1'})
    

    Parameters

    Returns Promise<AsyncResult<CommonRequestResult>>

Const unblockChatRoomMembers

  • 批量将成员从聊天室黑名单移除。该方法只有聊天室所有者和管理员才有权限调用。

    connection.unblockChatRoomMembers({chatRoomId: 'chatRoomId', usernames: ['user1', 'user2']})
    

    Parameters

    Returns Promise<AsyncResult<CommonRequestResult[]>>

Const unmuteChatRoomMember

  • 解除对聊天室用户的禁言。该方法只有聊天室所有者和管理员才有权限调用。被解除禁言的用户和其他用户会在 onChatroomEvent 的回调里收到 "operation: 'unmuteMember'"。

    connection.unmuteChatRoomMember({chatRoomId: 'chatRoomId', username: 'user1'})
    

    Parameters

    Returns Promise<AsyncResult<UnmuteChatRoomMemberResult[]>>

updateChatRoomAnnouncement

uploadChatRoomSharedFile

  • uploadChatRoomSharedFile(params: { file: object; roomId: string; onFileUploadCanceled?: any; onFileUploadComplete?: any; onFileUploadError?: any; onFileUploadProgress?: any }): void
  • 上传一个聊天室共享文件。

    connection.uploadChatRoomSharedFile({roomId: 'roomId', file: 'file object', onFileUploadProgress: onFileUploadProgress, onFileUploadComplete: onFileUploadComplete,onFileUploadError:onFileUploadError,onFileUploadCanceled:onFileUploadCanceled})
    

    Parameters

    • params: { file: object; roomId: string; onFileUploadCanceled?: any; onFileUploadComplete?: any; onFileUploadError?: any; onFileUploadProgress?: any }
      • file: object

        上传的文件对象。

      • roomId: string

        聊天室 ID。

      • onFileUploadCanceled?:function
        • onFileUploadCanceled(data: any): void
        • 上传取消的回调。

          Parameters

          • data: any

          Returns void

      • onFileUploadComplete?:function
        • onFileUploadComplete(data: any): void
        • 上传完成的回调。

          Parameters

          • data: any

          Returns void

      • onFileUploadError?:function
        • onFileUploadError(data: any): void
        • 上传失败的回调。

          Parameters

          • data: any

          Returns void

      • onFileUploadProgress?:function
        • onFileUploadProgress(data: any): void
        • 上传进度的回调。

          Parameters

          • data: any

          Returns void

    Returns void

Generated using TypeDoc