You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// when a new chat message is shared in the meeting
28
28
}
29
+
30
+
overridefunonMessageRateLimitReset() {
31
+
// when the rate limit for sending messages of self is reset
32
+
}
29
33
})
30
34
```
31
35
32
36
The `onChatUpdates()` method will be called whenever there is a change in the chat messages. The `messages` parameter is a list of `DyteChatMessage` objects that have been sent in the chat.
33
37
34
38
The `onNewChatMessage()` method will be called whenever a new chat message is shared in the meeting. The `message` parameter is a `DyteChatMessage` object that has been sent in the chat.
35
39
40
+
The `onMessageRateLimitReset()` method will be called when the rate limit for sending messages of self is reset and you can send messages again. The default rate limit is 180 messages within 60 seconds.
Copy file name to clipboardExpand all lines: docs/android-core/chat/sending-a-chat-message.mdx
+38-6Lines changed: 38 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -28,19 +28,51 @@ You can send an image with the help of `meeting.chat.sendImageMessage()` and
28
28
sends it to the participants in the meeting.
29
29
30
30
```kotlin
31
-
val filePath ="file_path_of_image"
32
-
val fileName ="file_name"
33
-
meeting.chat.sendImageMessage(filePath, fileName)
31
+
meeting.chat.sendImageMessage(imageUri) { err ->
32
+
// Handle error if any
33
+
}
34
34
```
35
35
36
36
## Send a file
37
37
38
38
Sending a file is quite similar to sending an image. The only difference is that when you send an image, a preview will be shown in the meeting chat, which is not the case for sending files. That being said, an image can be sent as a file too using `meeting.chat.sendFileMessage()`.
39
39
40
40
```kotlin
41
-
val filePath ="file_path_of_image"
42
-
val fileName ="file_name"
43
-
meeting.chat.sendFileMessage(filePath, fileName)
41
+
meeting.chat.sendFileMessage(fileUri) { err ->
42
+
// Handle error if any
43
+
}
44
+
```
45
+
46
+
## Chat Errors
47
+
48
+
The `sendTextMessage` method returns a `ChatTextError` if the operation fails, `null` if successful. The error can be the following:
49
+
50
+
-`PermissionDenied`: The user does not have permission to send a message.
51
+
-`MessageIsBlank`: The message is empty.
52
+
-`CharacterLimitExceeded`: The message exceeds the character limit. Default limit is 2000 characters.
53
+
-`RateLimitBreached`: The user has sent too many messages in a short period of time.
54
+
55
+
Both `sendImageMessage` and `sendFileMessage` methods accept a callback function that will be called with a `ChatFileError` if the operation is not successful, otherwise with `null` if successful.
56
+
57
+
Possible `ChatFileError`s are:
58
+
59
+
-`FileFormatNotAllowed`: The file format is not allowed.
60
+
-`PermissionDenied`: The user does not have permission to send a file.
61
+
-`RateLimitBreached`: The user has breached the rate limit for sending messages.
62
+
-`ReadFailed`: The file could not be read.
63
+
-`UploadFailed`: The file could not be uploaded.
64
+
65
+
A `when` block can be used to handle these errors inside the callback, as shown below:
All the stage management APIs return a `StageError` if the operation fails. On success, they return `null`. The error type can be one of the following:
0 commit comments