Expand my Community achievements bar.

Enhance your AEM Assets & Boost Your Development: [AEM Gems | June 19, 2024] Improving the Developer Experience with New APIs and Events
SOLVED

connection session logout

Avatar

Former Community Member

I wanted to know how to tell if a ConnectSession has successfully logged out.  When I call the ConnectionSession.logout() is called the syn event listener is fired, which is also fired when the ConnectSession logs in.  I wanted to see if there was any property that would indicate the success of logout.  The only difference I see in the SyncEvent is that the isSyncrozied property is set to false when logout is called. 

Thanks for any info you can provide.

-chris

1 Accepted Solution

Avatar

Correct answer by
Former Community Member

Yes, once you successfully log in, connectSesion.isSynchronized is true and after logging out it is false. SO, you can use this property for your purpose.

Hope this helps.

Thanks

Hironmay Basu

View solution in original post

6 Replies

Avatar

Correct answer by
Former Community Member

Yes, once you successfully log in, connectSesion.isSynchronized is true and after logging out it is false. SO, you can use this property for your purpose.

Hope this helps.

Thanks

Hironmay Basu

Avatar

Level 2

I am  creating authenticationKey on PHP (server side) after then loging on flex ( client side) whit help of session.login();  and It is working fine. But when I am using session.logout(); for logout then it is not working.....When I am login as new user it is showing old user already loging...

Thanks

Rajsun2

Avatar

Level 2

I'm having the same problem, and also using an External Authentication token with PHP.  I see this last post was from October - did you ever fix it?

Logging-in is fine, and then if I want to close the session in Flex I thought this code would be sufficient:

sess.close();

sess.logout();

However if for example the same user then logs back in, the roster still shows his username as logged in, so it then updates and shows 2 users :

User1

User1(2)

i.e - The user was never properly logged out and the session seems to still exist.

Is there something I'm not doing here?  And whilst I'm on the subject of logging out - say for example the internet connection went down, or someone jst decided to navigate away from the webpage, is there a 100% method of guaranteeing that they would be automatically logged out of the chatroom.

Thanks in advance...

Avatar

Employee

Either session.logout or session.close should disconnect the user (session.close does more "cleanup" than session.logout).

We'll try it again making sure we test with external authentication but I can't see what would be different than, for example, logging in as a guest user.

If you wait long enough do you ever see the user that logged out being removed from the roster ?

We have some logic on the server that allows for reconnection if the user gets temporary disconnected (i.e. the network connection drops) but reconnects right away, but the effect should be that you never see the user leave the roster (and for sure you shouldn't see two instances of the user).

When you do see two instances that means that the server still sees two connections from a user with the same authentication token.

Do you by any chance "release" one ConnectSession / ConnectSessionContainer when you logout and recreate it when you login (i.e. you create a new view with a ConnectSessionContainer or you allocate a new ConnectSession). That would be the only thing I can think of that could possibly cause the problem (assuming the ConnectSession doesn't really get released and doesn't close properly and you now have two ConnectSession in your client).

One thing that would help is, as usual, for you to send the logs of your client in the case where you login / logout / login again and get two users in the roster.

Avatar

Level 2

Thanks Raff, I have just sent the log in a private message to you. I do indeed use views where, once the session is authenticated, the view changes(to a chat room with LCCS components), and then the session is auto-logged in. On logout this view changes back again.

Part of the session code is this:


<fx:Declarations>
<rtc:AdobeHSAuthenticator authenticationFailure="auth_authenticationFailureHandler(event)" authenticationSuccess="auth_authenticationSuccessHandler(event)" authenticationKey="{parentDocument.authToken}"  id="auth"/>
</fx:Declarations>


<rtc:ConnectSessionContainer id="sess" authenticator="{auth}"   autoLogin="true"  roomURL = "{parentDocument.roomName}"  width="100%" height="100%">


<s:VGroup  width="100%" height="100%" gap="10" paddingRight="0"  paddingBottom="10">

...components etc...

</s:VGroup>


</rtc:ConnectSessionContainer>

Please tell me it's something glaringly obvious/stupid...

Avatar

Employee

One thing that I am not sure is what happens when you logout and you have ConnectSessionContainer.autoLogin=true.

If the logout causes another automatic login, that could be your problem because you'll probably have your user also try to login again (by clicking on a login button ?)

Can you try to set autoLogin to false and do your login/logout programmatically ?

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] ----