Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

[AEM Gems Webinar] Accelerating Experience Manager as a Cloud Service development with Rapid Development Environments

limiting the number of chat items saved

Avatar

Level 2

Hi,

Is there  some way I can limit the number of chat items/messages saved in a room to, say, 5 or 10 or some other number?

Thanks,

Graeme

2 Replies

Avatar

Employee

Hi Graeme,

Right now there is no setting or API to limit the number of chat messages saved. (It might be an interesting feature request)

But if you definitely want to save just the last few items in the chat, then you can get the chat history (SimpleChatModel.history) and parse it and save the last few messages and save it in a collection node. (make sure to clear the chat after all the users leave the room) . Then as needed, you can subscribe to the collection node and you can set  SimpleChat.historyTextArea.htmlText = urHistoryCollectionNode.htmlText

Hope I was able to convey my idea.

Thanks

Arun