Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

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

Avatar

Level 2

Hi,

OK, I understand. Thanks for your help.

Graeme