tencent cloud

Feedback

JavaScript

Last updated: 2024-11-20 15:59:29

    TencentCloudChat

    TencentCloudChat is the namespace of the Chat JavaScript SDK and provides the static method create() for creating SDK instances, the event constant EVENT, and the type constant TYPES, and the signaling constant TSignaling.

    Initialization

    API
    Description
    create
    Creates an SDK instance.

    SDK Instance

    Term
    Description
    Message
    Message indicates the content to be sent and carries multiple attributes which specify whether you are the sender, the sender account, the message generation time, and so on.
    Two types of conversation are available:
    Client to Client (C2C): A one-to-one chat, involving only two participants.
    GROUP: A group chat, involving more than two participants.
    Profile
    Profile describes the basic information of a user, including the nickname, gender, personal signature, and profile photo URL.
    Friend
    Friend describes the basic information of a friend, including the remarks and friend list.
    FriendApplication
    FriendApplication describes the basic information of a friend request, including the friend source and remarks.
    FriendGroup
    FriendGroup describes the basic information of a friend group, including the friend group name and members.
    Group
    Group indicates a communication system for group chatting, including Work Group, Public Group, Meeting Group, Audio-Video Group, and Community Group.
    GroupMember
    GroupMember indicates the basic information of each group member, such as the ID, nickname, role, and the time of joining the group.
    Group tip
    A group tip is generated when an event such as adding or deleting group member occurs. The access side can configure whether to display group tips to group members.
    Group system message
    For example, when a user requests to join a group, the group admin receives a system message. After the admin accepts or rejects the request, the Chat SDK returns the result to the access side, which then displays the result to the user.
    Message display on screen
    The sent messages, including text segments and images, are displayed on the computer or phone screen.

    Event

    API
    Description
    on
    Enables event listening.
    off
    Disables event listening.

    Plugin registration

    API
    Description
    Registers a plugin.

    Setting log level

    API
    Description
    Sets the log level. Logs below this level will not be printed.

    SDK instance termination

    API
    Description
    destroy
    Terminates an SDK instance. The SDK will log out, disconnect the WebSocket persistent connection, and then release resources.

    Login

    API
    Description
    login
    Logs in to the Chat SDK using userID and userSig.
    logout
    Logs out to the Chat SDK.
    isReady
    Indicates the SDK enter the ready state or not.
    Get the userID of the logged-in user. If the user is not logged in, it returns an empty string ('').
    Get the server time.

    Message

    API
    Description
    Creates a text message.
    Creates a text message with the @ notification feature.
    Creates an image message.
    Creates an audio message.
    Creates a video message.
    Creates a custom message.
    Creates an emoji message.
    Creates a file message.
    Creates a location message.
    Creates a combined message.
    Downloads a combined message.
    Creates a forward message.
    Sends a message.
    Recalls a message.
    Deletes a message.
    Translates a message.
    Sets message extensions.
    Gets message extensions.
    Deletes message extensions.
    Add message reactions. This interface allows for scenarios such as "emoji reactions" to be implemented.
    Remove message reactions.
    Retrieve information of message reactions.
    Paginate and retrieve the user list for a specific message reaction.

    Conversation

    API
    Description
    Modifies a message.
    Gets the message list.
    Pulls the conversation message list by specified sequence or time range.
    Sends message read receipts.
    Pulls the list of message read receipts.
    Pulls the list of members who have (or have not) read a group message.
    Queries local messages in a specified conversation by messageID.
    Marks a message as read.
    Gets the conversation list.
    Gets the conversation information.
    Deletes a conversation.
    Set conversation draft.
    Clears the chat history with a user from local storage and the cloud (without deleting the conversation).
    Pins/Unpins a conversation to/from top.
    Marks the unread messages of all conversations as read.
    Sets the conversation message notification type. You can use this API to mute notifications or reject messages.
    Gets the total unread message count of conversations.

    Conversation group

    API
    Description
    Sets custom conversation data.
    Marks a conversation.
    Gets the list of conversation groups.
    Creates a conversation group.
    Deletes a conversation group.
    Renames a conversation group.
    Adds a conversation to a conversation group.
    Deletes conversations from a conversation group.

    Profile

    API
    Description
    Gets personal profile.
    Gets other user’s profile.
    Updates your personal profile.
    Gets your blocklist.
    Adds a user to the blocklist.
    Removes a user from the blocklist.

    User status

    API
    Description
    Sets one's own custom status.
    Queries a user's status.
    Subscribes to a user's status.
    Unsubscribes from a user's status.

    Relationship Chain

    API
    Description
    Gets the contacts in the SDK cache.
    addFriend
    Adds friends.
    Deletes friends.
    Verifies friend relationship.
    Gets the friend data and profile data of a specified user.
    Updates the contacts data of friends.
    Gets the friend request list in the SDK cache.
    Accepts a friend request.
    Rejects a friend request.
    Deletes a friend request.
    Set a friend request as reads.
    Gets list of friend groups in the SDK cache.
    Creates a friend group.
    Deletes a friend group.
    Adds friends to a friend group.
    Removes friends from a friend group.
    Modifies the name of a friend group.

    Group

    API
    Description
    Gets the group list.
    Gets the group profile.
    Creates a group.
    Disbands a group.
    Modifies the group profile.
    joinGroup
    Requests to join a group.
    quitGroup
    Quits a group.
    Searches for a group.
    Gets the number of online users in an audio-video group.
    Transfers the group ownership.
    Gets the list of requests to join a group.
    Processes requests to join the group.
    Initializes group attributes.
    Sets group attributes.
    Deletes group attributes.
    Gets group attributes.
    Sets group counters.
    Increases the specified group counters.
    Decreases the specified group counters.
    Gets the specified group counters.

    Group member

    API
    Description
    Gets the group member list.
    Gets a group member’s profile.
    Adds a group member.
    Deletes a group member.
    Configures the muting period.
    Modifies the group member’s role.
    Sets the name card for a group member.
    Sets a custom field for a group member.
    Marks group members.

    Topic

    API
    Description
    Gets the list of community groups the current user has joined.
    Creates a topic in a community group.
    Deletes a topic in a community group.
    Updates a topic profile in a community group.
    Gets the topic list in a community group.

    Signaling

    API
    Description
    Listens for a signaling event.
    Removes listener for a signaling event.
    invite
    Invites someone.
    Invites members in a group.
    cancel
    The inviter cancels the invitation.
    accept
    The invitee accepts the invitation.
    reject
    The invitee rejects the invitation.
    Gets signaling info from a message.
    Modifies a invitation.