Type constants in the SDK. To make the code simple and easy to read, some constants are described with common abbreviations. The details are as follows:
Abbreviation | Full Name |
---|---|
CONV | CONVERSATION |
GRP | GROUP |
MSG | MESSAGE |
SYS | SYSTEM |
MBR | MEMBER |
SNS | SNS (friend relationship chain) |
ACPT | ACCEPT |
NOTE | NOTIFY |
MULT | MULTIPLE |
Example
// Determine the message type
const isTextMessage = message.type === TIM.TYPES.MSG_TEXT // Whether the message is a text message
// Determine the conversation type
const isGroupConversation = conversation.type === TIM.TYPES.CONV_GROUP // Whether the conversation is a group conversation
Members
(static) MSG_TEXT
Message type: text message
(static) MSG_IMAGE
Message type: image message
(static) MSG_SOUND
Message type: audio message
Note: This is disused. Please use MSG_AUDIO instead.
(static) MSG_AUDIO
Message type: audio message
(static) MSG_FILE
Message type: file message
(static) MSG_VIDEO
Message type: video message
(static) MSG_GEO
Message type: location message
(static) MSG_GRP_TIP
Message type: group notification
(static) MSG_GRP_SYS_NOTICE
Message type: group system message
(static) MSG_CUSTOM
Message type: custom message
(static) MSG_MERGER
Message type: combined message. Supported from v2.10.1
(static) MSG_PRIORITY_HIGH
High priority of group message. Recommended message type: red packet and gift message
(static) MSG_PRIORITY_NORMAL
Normal priority of group message. Recommended message type: common text message
(static) MSG_PRIORITY_LOW
Low priority of group message. Recommended message type: like message
(static) MSG_PRIORITY_LOWEST
Lowest priority of group message. Recommended message type: least important message
(static) CONV_C2C
Conversation type: Client to Client (C2C) conversation
(static) CONV_GROUP
Conversation type: group conversation
(static) CONV_SYSTEM
Conversation type: system conversation
(static) GRP_PRIVATE
- Disused:
-
- This is disused from v2.7.1. Please use GRP_WORK instead.
Group type: private group
(static) GRP_WORK
Group type: work group
(static) GRP_PUBLIC
Group type: public group
(static) GRP_CHATROOM
- Disused:
-
- This is disused from v2.7.1. Please use GRP_MEETING instead.
Group type: chat room
(static) GRP_MEETING
Group type: temporary meeting group
(static) GRP_AVCHATROOM
Group type: audio-video group
(static) GRP_MBR_ROLE_OWNER
Group member role: group owner
(static) GRP_MBR_ROLE_ADMIN
Group member role: admin
(static) GRP_MBR_ROLE_MEMBER
Group member role: common group member
(static) GRP_TIP_MBR_JOIN
Group notification: a member joins the group.
(static) GRP_TIP_MBR_QUIT
Group notification: a member leaves the group.
(static) GRP_TIP_MBR_KICKED_OUT
Group notification: a group member is removed from the group.
(static) GRP_TIP_MBR_SET_ADMIN
Group notification: a group member is granted the group admin role.
(static) GRP_TIP_MBR_CANCELED_ADMIN
Group notification: the group admin role of a group member is revoked.
(static) GRP_TIP_GRP_PROFILE_UPDATED
Group notification: the group profile is modified.
(static) GRP_TIP_MBR_PROFILE_UPDATED
Group notification: the profile of a group member is modified.
(static) MSG_REMIND_ACPT_AND_NOTE
Notification type of group messages: the SDK receives a message and notifies the access side, which then sends a notification.
(static) MSG_REMIND_ACPT_NOT_NOTE
Notification type of group messages: the SDK receives a message and notifies the access side, which then does not send any notifications.
(static) MSG_REMIND_DISCARD
Notification type of group messages: the SDK rejects a message.
(static) GENDER_UNKNOWN
Gender: unspecified
(static) GENDER_FEMALE
Gender: female
(static) GENDER_MALE
Gender: male
(static) KICKED_OUT_MULT_ACCOUNT
Kicked-offline type: kicked-offline due to multi-account login
(static) KICKED_OUT_MULT_DEVICE
Kicked-offline type: kicked-offline due to multi-device login
(static) KICKED_OUT_USERSIG_EXPIRED
Kicked-offline type: kicked-offline type due to signature expiration
(static) ALLOW_TYPE_ALLOW_ANY
When receiving friend requests from others: automatically accept all friend requests received
(static) ALLOW_TYPE_NEED_CONFIRM
When receiving friend requests from others: manually accept friend requests received
(static) ALLOW_TYPE_DENY_ANY
When receiving friend requests from others: reject all friend requests received
(static) FORBID_TYPE_NONE
Whether the admin prohibits the user from initiating a friend request: allow the user to initiate a friend request (default value)
(static) FORBID_TYPE_SEND_OUT
Whether the admin prohibits the user from initiating a friend request: prohibit the user from initiating a friend request
(static) JOIN_OPTIONS_FREE_ACCESS
Group joining option: allow free group joining
(static) JOIN_OPTIONS_NEED_PERMISSION
Group joining option: require admin approval for group joining
(static) JOIN_OPTIONS_DISABLE_APPLY
Group joining option: forbid group joining
(static) JOIN_STATUS_SUCCESS
Group joining request status: joined the group successfully
(static) JOIN_STATUS_ALREADY_IN_GROUP
Group joining request status: already in the group
(static) JOIN_STATUS_WAIT_APPROVAL
Group joining request status: waiting to be approved by the admin
(static) GRP_PROFILE_OWNER_ID
Group profile: group owner ID
(static) GRP_PROFILE_CREATE_TIME
Group profile: group creation time
(static) GRP_PROFILE_LAST_INFO_TIME
Group profile: latest group profile modification time
(static) GRP_PROFILE_MEMBER_NUM
Group profile: number of group members in the current group
(static) GRP_PROFILE_MAX_MEMBER_NUM
Group profile: maximum number of group members in the current group
(static) GRP_PROFILE_JOIN_OPTION
Group profile: group joining option
(static) GRP_PROFILE_INTRODUCTION
Group profile: group introduction
(static) GRP_PROFILE_NOTIFICATION
Group profile: group notice
(static) GRP_PROFILE_MUTE_ALL_MBRS
Group profile: whether to mute all members (supported from v2.6.2)
(static) SNS_ADD_TYPE_SINGLE
Friend adding mode: one-way friend adding
(static) SNS_ADD_TYPE_BOTH
Friend adding mode: two-way friend adding
(static) SNS_DELETE_TYPE_SINGLE
Friend deletion mode: one-way friend deletion
(static) SNS_DELETE_TYPE_BOTH
Friend deletion mode: two-way friend deletion
(static) SNS_APPLICATION_TYPE_BOTH
Friend request pulling: pulling friend requests received and sent by me
(static) SNS_APPLICATION_SENT_TO_ME
Friend request pulling: pulling friend requests received by me
(static) SNS_APPLICATION_SENT_BY_ME
Friend request pulling: pulling friend requests sent by me
(static) SNS_APPLICATION_AGREE
Friend request accepting mode: agree to add as a one-way friend
(static) SNS_APPLICATION_AGREE_AND_ADD
Friend request accepting mode: agree to add as a two-way friend
(static) SNS_CHECK_TYPE_BOTH
Friend verification: two-way friend verification
(static) SNS_CHECK_TYPE_SINGLE
Friend verification: one-way friend verification
(static) SNS_TYPE_NO_RELATION
Friend relationship: A and B are not on each other's friend list
(static) SNS_TYPE_A_WITH_B
Friend relationship: B is on A's friend list, but A is not on B's friend list
(static) SNS_TYPE_B_WITH_A
Friend relationship: B is not on A's friend list, but A is on B's friend list
(static) SNS_TYPE_BOTH_WAY
Friend relationship: A and B are on each other's friend list
(static) NET_STATE_CONNECTED
Network status: connected (supported from v2.5.0)
(static) NET_STATE_CONNECTING
Network status: connecting (supported from v2.5.0)
(static) NET_STATE_DISCONNECTED
Network status: disconnected (supported from v2.5.0)
(static) MSG_AT_ALL
@ all members during a group chat (supported from v2.9.0)