Constructor
new TIM()
Classes
Members
(static) instance
返回该类实例
Methods
init(sdkAppId, userId, userSig, chatGroupId, cmdGroupId)
模块初始化接口
Parameters:
| Name | Type | Description |
|---|---|---|
sdkAppId |
应用标识SDKAPPID |
|
userId |
用户名 |
|
userSig |
用户签名 |
|
chatGroupId |
聊天群组ID |
|
cmdGroupId |
信令群组ID |
enableLog(sendTextLog, sendCustomLog, recvTextLog, recvCustomLog)
控制台日志打印开关(for 自动化测试使用)
Parameters:
| Name | Type | Default | Description |
|---|---|---|---|
sendTextLog |
false
|
是否打印发送文本消息日志 |
|
sendCustomLog |
true
|
是否打印发送自定义消息日志 |
|
recvTextLog |
false
|
是否打印接收文本消息日志 |
|
recvCustomLog |
true
|
是否打印接收自定义消息日志 |
login(userId, userSig)
登录接口
Parameters:
| Name | Type | Description |
|---|---|---|
userId |
用户ID |
|
userSig |
用户签名 |
logout()
注销接口
joinGroup(groupId)
加入群组
Parameters:
| Name | Type | Description |
|---|---|---|
groupId |
群组ID |
quitGroup(groupId)
退出群组
Parameters:
| Name | Type | Description |
|---|---|---|
groupId |
群组ID |
sendGroupTextMessage(text)
发送群组文本消息
Parameters:
| Name | Type | Description |
|---|---|---|
text |
文本消息 |
getCurrnetImgId()
获取发送图片 ID
sendGroupImgMessage(image)
发送群组图片消息
Parameters:
| Name | Type | Description |
|---|---|---|
image |
图片 |
sendGroupCustomMessage(ext, data)
发送群组自定义消息
Parameters:
| Name | Type | Description |
|---|---|---|
ext |
扩展标识 |
|
data |
内容 |
sendC2CTextMessage(userId, text)
发送C2C文本消息
Parameters:
| Name | Type | Description |
|---|---|---|
userId |
用户ID |
|
text |
文本内容 |
sendC2CCustomMessage(userId, ext, data)
发送C2C自定义消息
Parameters:
| Name | Type | Description |
|---|---|---|
userId |
用户ID |
|
ext |
扩展标识 |
|
data |
内容 |
getMessageList(groupId, count, nextMsgId)
拉取消息列表
Parameters:
| Name | Type | Default | Description |
|---|---|---|---|
groupId |
群组id |
||
count |
消息数量 |
||
nextMsgId |
null
|
起始消息id |
markMessageAsRead(msgSeq)
标记指定消息为已读消息
Parameters:
| Name | Type | Description |
|---|---|---|
msgSeq |
消息序列号 |
markAllMessagesAsRead()
标记所有消息为已读消息
addMsgToList(msg)
添加消息到消息列表
Parameters:
| Name | Type | Description |
|---|---|---|
msg |
要添加的消息 |
getClassMessageList()
拉取公开课最近20条消息列表
removeMsgFromList(msg)
从消息列表删除消息
Parameters:
| Name | Type | Description |
|---|---|---|
msg |
要删除的消息 |
silenceUserOnMsgList(userId, silence)
修改消息列表内指定用户的禁言状态
Parameters:
| Name | Type | Description |
|---|---|---|
userId |
要修改状态的用户ID |
|
silence |
目标禁言状态 |