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 get non persistent chat

Avatar

Level 1

I'm trying to modify the SimpleChatExample to use non persistent chat, So that users only see chat that happens when their in the room. I can't figure out what i need to change to make it work like this.

Any help much appreciated.

-brett

0 Replies

Avatar

Level 2

This actually "could" be very simple. I say could because I am not precisely sure of what other effects this could have but if you check the SimpleChatModel and change the node setups within:  protected function onSynchronizationChange(p_event:CollectionNodeEvent) and change the storage scheme from NodeConfiguration.STORAGE_SCHEME_QUEUE to NodeConfiguration.STORAGE_SCHEME_SINGLE_ITEM the chat items won't persisit on the server side. And only the very last message should be in those nodes. I hope that helps a little...

Ves

Avatar

Level 10

Hi ,

I differ with the earlier post as changing the itemStorage scheme from queue to single item would send you just one message at a time. So when you will be in a room, you will just get the last message. The right parameter to change is persistItems. Here is what you can do.

There is a setNodeConfiguration API in SimpleChatModel class where you need to set the nodeConfiguration for History Nodes with the value persisItems as false. The default value for persistItems in all history nodes is true.


There is a history node for everyone called HISTORY_NODE_EVERYONE. And there are history nodes called HISTORY_NODE_PARTICIPANTS and HISTORY_NODE_HOSTS which are used to if you are sending it to only hosts to only hosts and participents.

The way you can change the persistItems

var nodeConf:NodeConfiguration = model.getConfiguration(nodeName);

nodeConf.persistItems =false ;

mode.setConfiguration(nodeName, nodeConf);

Now , One thing i wanted to point here is whenever u clear the the chat , it actually deletes and recreates the history nodes with the old configuration. So, you might have to be careful that if you are clearling the chat, then you might need to change the persistItems  again like above.

Another option is , the two functions onSynchronizationChange and clear are the places where we create the History Nodes , you can override them to create the nodes with your nodeConfigurations. And to know more about persistItems parameter in NodeConfiguration, please look at docs of NodeConfiguration.

Thanks

Hironmay Basu

Avatar

Level 1

Hi Hironmay-

I tried the following:

var nodeConf:NodeConfiguration = chatModel.getNodeConfiguration("HISTORY_NODE_EVERYONE");

nodeConf.persistItems =

false ;

chatModel.setNodeConfiguration(

"HISTORY_NODE_EVERYONE", nodeConf);

and got this error :

TypeError: Error #1009: Cannot access a property or method of a null object reference.

at com.adobe.rtc.pods.simpleChatClasses::SimpleChatModel/getNodeConfiguration()[....SimpleChatModel.as:388]

i also tried unchecking persistItems for the history nodes in Node Details via the AFCS Dev Console. that seems to make messages non persistent but only the first message sent shows up. every message after that never shows up in my chat window.

thanks.

-brett

Avatar

Level 10

Hi,

Are you getting the node Configuration after your model is subscribed and synchornized?  I would run it on my side and will see whats the problem happening and will revert back to you.

Thanks

Hironmay Basu