Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

Changing userID

Avatar

Level 3

I have userID .../27
I hook up with userID .../26


But when this user loggs out his userID  is .../24 in p_evt.userDescriptor.userID:


         _cSession.userManager.addEventListener(UserEvent.USER_BOOTED,onUserRemove);


        function onUserRemove(p_evt:UserEvent):void {
            debug("onUserRemove p_evt.userDescriptor.userID "+p_evt.userDescriptor.userID);
        }

isnt that strange?

I see that the user exists twice. When I refresh the browser to disconnect the first time onUserRemove isnt called at al. After this refresh there is a twin user added. When I refresh again the first user is  removed and calls onUserRemove. And again there is no remove event of the use I'm acually hooked up with.

henry

6 Replies

Avatar

Employee

Not sure I understand the problem, but I suspect the browser refresh is the root cause: closing the browser (and I would guess refreshing the window) doesn't always send the correct events to the FlashPlayer so the player and/or our server may think the user is still connected, Refreshing multiple times may just give the server enough time to finally understand the user has been disconnected and remove it from the list.

Avatar

Level 3

1.I start my page

     a. user A is added.

2. I refresh the browser

     a. onUserRemove is NOT called

     b. user A stays connected.    

     c. user B is added.
3. I refresh the browser

     a. onUserRemove is called, but with the UserID of user A.

     b. user A is than deleted in onUserRemove

     c. user B stays connected.   

     d. user C is added.

This goes on forever leaving always 2 user per browser.

Avatar

Former Community Member

Hi there,

Have you tried waiting a minute or 2 between refreshes? Sometimes, the

browser will take a little time truly garbage-collecting the connection, and

it will fix itself within a couple of minutes.

nigel

Avatar

Level 3

the problem comes already after first single refresh.

the server doesnt recognise the refresh/logout/disconnect. but flash should receive an event no? mabe we can use a flash onTermination event to kill the user?

Avatar

Former Community Member

Sorry, what I'm saying is that the problem should fix itself after a small amount of time (2 minutes is usually more than enough). If you do catch events for the browser refreshing, you should be able to call logout() on the ConnectSession to force this.

Avatar

Level 3

yeah, I tried


            stage.addEventListener(Event.DEACTIVATE, onDeactivate);

but its only triggered when closing the debug window and not on refreshing or closing the browser.

I could store the UserID in a SharedObject and logout the prev user when logging in, but this method may be insecure no?