I'm looking for an efficient way to get and update count of unread messages in twilio chat. I've reviewed related Q&A here (like this ), and the anser was about looping through the Channel's array and Message Consumption Horizon. Is it the one way to solve it? It's not a cheap approach from the point of view of perfomance.
The second question is about ability to update this count on the fly - so, is there a way to create a notification for user with event handler for incomming messages (not push notifications) to update counter of unread messages in real time?
thanks in advance
here is the way I've used to update the unread count real-time.
Refer Channel/Conversation: For twilio-chat consider channel & for twilio-conversation consider conversation .
Listen to the 'messageAdded' event of ConversationClient. So whenever a new message is added you can check below:
Hope this is helpful.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.