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.
SOLVED

Join/Leave room event control

Avatar

Former Community Member

Hi,

What would be the best method to control when a user enters or leaves a room? I have a data base keeping control on how many users each of my rooms has, and I'm looking to implement a good method to keep it up to date as it's very important for my application. Are there more possibilites appart from controlling it from the client side? I think that won't be valid as a client could have for example some connection problem and then it won't be able to send the "I left the room message" to my server. Is there some way to a call from the adobe server to some php function on my server when that occurs?

Thanks for your help!

1 Accepted Solution

Avatar

Correct answer by
Former Community Member

Hi,

One way from the client side would be listening to UserEvent.USER_REMOVE event from UserManager. This gets fired when the user item gets retracted from on server.

We mainly use this for any client side bookkeeping of userlists.

However, using server to server API your server can listen to the UserManager Collection once you have called registerhook, and subscribed to UserManager Collection. There is a php example in sampleApps for your server registering hook and listening to a collection node like UserManager.

Thanks

Hironmay Basu

View solution in original post

2 Replies

Avatar

Correct answer by
Former Community Member

Hi,

One way from the client side would be listening to UserEvent.USER_REMOVE event from UserManager. This gets fired when the user item gets retracted from on server.

We mainly use this for any client side bookkeeping of userlists.

However, using server to server API your server can listen to the UserManager Collection once you have called registerhook, and subscribed to UserManager Collection. There is a php example in sampleApps for your server registering hook and listening to a collection node like UserManager.

Thanks

Hironmay Basu

Avatar

Former Community Member

Thanks for the fast response! I was not sure I could manage that with the server 2 server api, I think I am taking that way. I will take a deep look into it and post if I have any further question.

The following has evaluated to null or missing: ==> liqladmin("SELECT id, value FROM metrics WHERE id = 'net_accepted_solutions' and user.id = '${acceptedAnswer.author.id}'").data.items [in template "analytics-container" at line 83, column 41] ---- Tip: It's the step after the last dot that caused this error, not those before it. ---- Tip: If the failing expression is known to be legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)?? ---- ---- FTL stack trace ("~" means nesting-related): - Failed at: #assign answerAuthorNetSolutions = li... [in template "analytics-container" at line 83, column 5] ----