Expand my Community achievements bar.

Radically easy to access on brand approved content for distribution and omnichannel performant delivery. AEM Assets Content Hub and Dynamic Media with OpenAPI capabilities is now GA.

Clear private chat with SimpleChatModel

Avatar

Level 1

Hi folks,

as I figured out working with the LCCS there is a posibility to let people chat directly(private) to each other via the ChatMessageDescriptor's recipient Attribute.

This works fine but if the user logs in again with the the same credentials and therefore gets the same Auth-Token, ALL private messages that has been sent to or by this person trigger again the History.Changed Event after subscribing to the same collection note.

So my question is if there is a possibility to clear those private messages without giving all user the "owner" permission?

Or do I always have to generate a different userID (maybe acc. to the Timestamp the login to the LCCS's collectionNode?

Thanks in advance,

Michael

1 Reply

Avatar

Employee

Hi Michael,

Sorry for the delayed reply. I tested the scenario  you mentioned. If the chat is entirely private and if

sessionDependent="true"

is set to true for the SimpleChatModel, then we can achieve the use case you mentioned. [Try running the app as Owner first to set the sessionDependent to true. ]

Code

<?xml version="1.0" encoding="utf-8"?>

<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"

                  xmlns:s="library://ns.adobe.com/flex/spark"

                  xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600"

                  xmlns:pods="com.adobe.rtc.pods.*" xmlns:collab="com.adobe.rtc.collaboration.*" xmlns:session="com.adobe.rtc.session.*" xmlns:authentication="com.adobe.rtc.authentication.*">

     <fx:Declarations>

          <!-- Place non-visual elements (e.g., services, value objects) here -->

          <authentication:AdobeHSAuthenticator

               id="auth"

               userName="Guest"

  />

     </fx:Declarations>

     

     <fx:Script>

          <![CDATA[

               import com.adobe.rtc.events.ChatEvent;

               

               import mx.events.FlexEvent;

               

               protected function sChat_creationCompleteHandler(event:FlexEvent):void

               {

                    // TODO Auto-generated method stub

                    sChat.model.addEventListener(ChatEvent.HISTORY_CHANGE,onChatChange);

               }

               

               protected function onChatChange(p_evt:ChatEvent):void

               {

                    trace("HistChange recieved");

               }

          ]]>

     </fx:Script>

          

     <session:ConnectSessionContainer roomURL="room URL" id="cSession" authenticator="{auth}" width="100%" height="100%">

          <pods:SimpleChat id="sChat" width="40%" height="100%" sessionDependent="true" creationComplete="sChat_creationCompleteHandler(event)"/>

          <!-- <s:Button click="{sChat.model.clear()}" label="clear" /> -->

     </session:ConnectSessionContainer>

     

</s:Application>

Thanks

Arun