TIM is the namespace of the IM Web SDK and provides the create() static method, the EVENT event constant, and the TYPES type constant.
Concept | Description |
---|---|
Message | A message indicates the information to be sent. It carries multiple properties, which specify whether you are the sender, the sender account, the message generation time, and others. |
Conversation | There are two types of conversations: |
Profile | The profile describes the basic information of a user, including the nickname, profile photo URL, personal signature, and gender. |
Group | Group in IM SDK is a communication system for group chatting, including Work, Public, Meeting, and AVChatRoom. |
GroupMember (group member) | GroupMember specifies the basic information of each group member, such as the ID, nickname, group role, and joining time. |
Group notification | A group notification is generated when an event, such as the addition or deletion of a group member, occurs. You can configure whether to display group notifications to group members. For more information on group notification types, see Message.GroupTipPayload. |
Group system message | For example, when a user applies for joining a group, the group admin will receive a system message. After the admin accepts or denies the application, the IM SDK returns the application result to the access terminal, and then the user can view the result on the access terminal. For more information on the types of group system messages, see Message.GroupSystemNoticePayload. |
Message on-screen display | This is the process by which messages, including text and images, are displayed on the computer or mobile phone screen after the user clicks send. |
The IM SDK supports IE 9+, Chrome, WeChat, Mobile QQ, QQ Browser, FireFox, Opera, and Safari.
The IM SDK calls APIs in the following sequence.
Operation | Value | Description |
---|---|---|
Create an SDK instance | TIM.create(options) | Creates an SDK instance (which is usually represented by tim) by using a TIM factory function. |
Set the log level | tim.setLogLevel(level) | Sets the log level. Logs with lower levels will not be output. |
Register the plugin | tim.registerPlugin(optoins) | Cloud Object Storage (COS) must be registered as the upload plugin of the IM SDK to upload images, files, and other media. |
Listen for events | tim.on(event, handler) | Listens for events and handles data thrown by the SDK in the handler. |
Login | tim.login(options) | Messages can be sent and received after login succeeds and the SDK is ready. |
Create a text message | tim.createTextMessage(options) | Creates text messages. This API returns a message instance that can be immediately displayed on the screen by the access terminal. |
Send a message | tim.sendMessage(message) | Sends message instances that have been created. |
Obtain the conversation list | tim.getConversationList() | Obtains the conversation list. The access terminal can then process conversation list data and render the conversation list interface. |
Obtain the group list | tim.getGroupList() | Obtains the group list. The access terminal can then process group list data and render the group list interface. |
Obtain the blocklist | tim.getBlacklist() | Obtains the blocklist. The access terminal can then process blocklist data and render the blocklist interface. |
Obtain the personal profile | tim.getMyProfile() | Obtains the user’s personal profile. The access terminal can then process personal profile data and render the personal profile interface. |
Logout | tim.logout() | Logs users out. |
Was this page helpful?