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

How to limit Chat History to the current connected session

Avatar

Level 2

Is there a configuration at the time of node creation?

4 Replies

Avatar

Level 10

Yes , you can specify a configuration at the time of creating a node. You will many examples of this in our sources.

The createNode call in CollectionNode takes a NodecConfiguration, which you don't specify takes the default one. There is a nodeConfiguration parameter called sessionDependentItems , which is false by default. If you are creating a SimpleChatModel, you can do new SimpleChatModel(true), which will basically set this parameter to true. Otherwise if you are creating a node by yourself, you can do something like this

var nodeConfig:NodeConfiguration = new NodeConfiguration();

nodeConfig. sessionDependentItems = true;

collectionNode.createNode("yournodeName",nodeConfig);

Hope this helps. Refer to the docs of SimpleChatModel,NodeConfiguration and CollectionNode for details

Thanks

Regards

Hironmay Basu

Avatar

Level 2

At the time of node creation I am setting value of sessionDependentItems to true . this change is not working / not giving the expected result

When user logged out and logged again, still user can see previous chat history

Following is my function in which i am setting the sessionDependentItems  value to true[highlighted in yellow]

protected function onSynchronizationChange(event:CollectionNodeEvent):void {

                 

                  if (_collectionNode.isSynchronized) {

                        //Creates the nodes if they don't exist

                        if (!_collectionNode.isNodeDefined(START_CHAT_LIST) && _collectionNode.canUserConfigure(connectSession.userManager.myUserID)) {

                              _collectionNode.createNode(START_CHAT_LIST, new NodeConfiguration(UserRoles.VIEWER, UserRoles.VIEWER, true, false, true,true, NodeConfiguration.STORAGE_SCHEME_QUEUE));

                        }

                  }

                 

            }

Avatar

Level 10

Hi,

My first question, are you completely writing your own chat model or you are overriding our classes. You need to provide me a small test case where its not working and how you are trying it. You can pm me. SessionDependent Items has been there since beginning and has always worked. There could be something wrong in your code.

Thanks

Hironmay Basu

Avatar

Level 2

I am setting SessionDependent Items value to true inside onSynchronizationChange in my code.

Following are the two instance of onSynchronizationChange

Inside Connect session class

public function connectChat() :void

{

trace('connectChat');

_collectionNode =

new CollectionNode();

_collectionNode.sharedID = NOTIFICATION_COLLECTION_NODE;

_collectionNode.connectSession =

this.connectSession;

_collectionNode.addEventListener(CollectionNodeEvent.SYNCHRONIZATION_CHANGE, onSynchronizationChange,

false, 0, true);

_collectionNode.addEventListener(CollectionNodeEvent.ITEM_RECEIVE, onItemReceive,

false, 0, true);

_collectionNode.subscribe();

}

/**

* @private

* Handles the creation of a collection node if it does not already exist

*/

protected function onSynchronizationChange(event:CollectionNodeEvent):void {

if (_collectionNode.isSynchronized) {

//Creates the nodes if they don't exist

if (!_collectionNode.isNodeDefined(START_CHAT_LIST) && _collectionNode.canUserConfigure(connectSession.userManager.myUserID)) {

_collectionNode.createNode(START_CHAT_LIST,

new NodeConfiguration(UserRoles.PUBLISHER, UserRoles.PUBLISHER, true