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.

how about one to one chat switch?

Avatar

Former Community Member

one to one audio chat, both users can click switch,then user would conect to another same-flag user.

So,question:

how to detect if the user is already in another one-to-one chat,if the user is idle for connecting.

how to add custom flag to user model,create customized collectionNodes and Node?

thanks,btw,if you can provide best practice to this scenario,that would be appreciated!

4 Replies

Avatar

Former Community Member

Or i can make a shared node,and add items to it?

Avatar

Former Community Member

hey,empoyees here.

any idea?

I think this is very common requirement to lccs.

Avatar

Former Community Member

Hi Vincent,

I'm not sure I understand the problem, but since you're helping out with other users I can't rightfully ignore you =).

So, you need a shared model to hold the current "who is chatting with whom" state of the room. A SharedObject or SharedCollection would be a good way to store that information.

  How I'd do it :  every time someone starts chatting, have them add something like SharedObject.setProperty(userID1, userID2) and also have the other participant add SharedObject.setProperty(userID2, userID1). Meaning, I'd have each user store their userID as a key in the sharedObject, in order to look it up more easily. Then, if I wanted to know whether a given user is chatting with someone else, I could just do sharedObject.getProperty(userID). If null, then that person's not chatting, and if non-null, then I know who he's chatting with. Don't forget, once the users leave that chat, to remove the property. I'd also set a NodeConfiguration with userDependentItems=true, which means if the user leaves, any property they set will be retracted automatically.

  hope that helps

   nigel

Avatar

Former Community Member

well,finally got one answer.

now,i know how to maintain the state .

one more question:

when user click switch,

the user should search for one another random user ,then he get one user who is not in chat.

then,how to notify him to keep idle to not respose to other users.

make a note localhost,like setting waiting_for_response=true ,Sending Message,then user_b get the message ,send back confirm_message to user_a to confirm the connection?

this way should be best practice ,right? why i ask here is that i think might lccs provide some built in function or solution for this requirement.

thanks!