Receiving chat messages
To be able to receive chat messages you need to implement a method
onChatUpdates()
method from callback DyteChatEventsListener
. You can
subscribe to this events by calling
meeting.addChatEventsListener(dyteChatEventsListener)
extension MeetingViewModel: DyteChatEventsListener {
func onChatUpdates(messages: [DyteChatMessage]) {
// to load chat messages
}
func onNewChatMessage(message: DyteChatMessage) {
// when a new chat message is shared in the meeting
}
func onMessageRateLimitReset() {
// when the rate limit for sending messages of self is reset
}
}
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.
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.
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.