ChatContext
provides the methods that can be called by your app for the chat module.
abstract fun sendLocalChannelMessage(message: String, timestamp: Long,
callback: EduContextCallback<EduContextChatItemSendResult>): EduContextChatItem
Sends a classroom message.
Parameter | Description |
---|---|
message |
The message. |
timestamp |
The timestamp when the message is sent. |
callback |
Gets the result of sending the message asynchronously through EduContextCallback . |
abstract fun fetchChannelHistory(startId: String?, count: Int? = 50, callback: EduContextCallback<List<EduContextChatItem>>)
Fetches the history of classroom messages.
Parameter | Description |
---|---|
startId |
You need to pass in a messageId , which indicates you need to get this message and messages sent before this message. |
count |
The number of messages you want to get. |
callback |
Get the result of fetching the message history asynchronously through EduContextCallback . |
abstract fun sendConversationMessage(message: String, timestamp: Long,
callback: EduContextCallback<EduContextChatItemSendResult>): EduContextChatItem
Sends a peer-to-peer message to a remote user.
Parameter | Description |
---|---|
message |
The message. |
timestamp |
The timestamp when the message is sent. |
callback |
Gets the result of sending the message asynchronously through EduContextCallback . |
abstract fun fetchConversationHistory(startId: String?, callback: EduContextCallback<List<EduContextChatItem>>)
Fetches the history of peer-to-peer messages.
Parameter | Description |
---|---|
startId |
You need to pass in a messageId , which indicates you need to get this message and messages sent before this message. |
callback |
Get the result of fetching the message history asynchronously through EduContextCallback . |
IChatHandler
reports the message-related event callbacks to your app.
fun onReceiveMessage(item: EduContextChatItem)
Occurs when the local client receives a classroom message.
Parameter | Description |
---|---|
item |
The message object. See EduContextChatItem for details. |
fun onReceiveChatHistory(history: List<EduContextChatItem>)
Occurs when the history of classroom messages is updated.
Parameter | Description |
---|---|
history |
An array of message objects. See EduContextChatItem for details. |
fun onReceiveConversationMessage(item: EduContextChatItem)
Occurs when the local client receives a peer-to-peer message from a remote user.
Parameter | Description |
---|---|
item |
The message object. See EduContextChatItem for details. |
fun onReceiveConversationHistory(history: List<EduContextChatItem>)
Occurs when the history of peer-to-peer messages is updated.
Parameter | Description |
---|---|
history |
An array of message objects. See EduContextChatItem for details. |
fun onChatAllowed(allowed: Boolean)
Occurs when the global chat permission changes.
Parameter | Description |
---|---|
allowed |
Whether the local client has the permission to chat. |
fun onChatAllowed(allowed: Boolean, userInfo: EduContextUserInfo, operator: EduContextUserInfo?, local: Boolean)
Occurs when the chat permissions of a single user changes.
Parameter | Description |
---|---|
allowed |
Whether the local client has the permission to chat. |
userInfo |
The information of the user whose chat permission has changed. See EduContextUserInfo. |
operator |
The information of the operator. See EduContextUserInfo. |
local |
Whether the user is the local user. |
fun onChatTips(tip: String)
Reports the tips related to the chat.
There are the following tips:
Parameter | Description |
---|---|
tip |
The tip. |