Expand my Community achievements bar.

basic chat - intercept messages

Avatar

Level 1

Hi I'm wondering if there is any way to

Apply filters in real time to some words - you know the sort/public chat.

It's nothing that has to be covert but I could do with some tips/direction on this.

Back later with another one..

Thanks in advance.

Kevin

2 Replies

Avatar

Former Community Member

Hi Kevin,

Absolutely, it's possible, but it involves building your own chat UI (which really, is a TextInput and an EmoticonTextArea, so no big deal). Have a look at the examples folder of the SDK, under "SimpleChat". This sets up a SimpleChatModel (essentially, all that you need to chat, minus UI), builds some UI around it, and listens for the HISTORY_CHANGE event to update the UI when new messages are received. In your case, you can intercept any new chat messages and apply whatever filtering you'd like, before sending them to whatever UI you're using.

hope that helps.

nigel

Avatar

Former Community Member

Hi,

I am not sure I understood your question correctly but if you need to filter some words at real time in SImpleChat of AFCS,you can  also override the formatMessageDescriptor function in SImpleChatModel.as which actually takes a MessageDescriptor string and builds the chat string. There you can apply the filter and filter out words or you can do it complete in your own UI as nigel suggested.

Thanks

Hironmay Basu