Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

Errors When Participant Leaves The Room

Avatar

Level 3

I get the following two errors when a user leaves/closes the browser session. I think the first is for the person leaving and the second is for the person who stays.

Is there a way to catch these errors and prevent them from happening?

TypeError: Error #1009: Cannot access a property or method of a null object reference.
    at com.adobe.rtc.messaging.manager::MessageManager/onUserRemove()[C:\work\main\connect\cocomo\src\com\adobe\rtc\messaging\manager\MessageManager.as:745]
    at flash.events::EventDispatcher/dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at com.adobe.rtc.sharedManagers::UserManager/userRemoved()[C:\work\main\connect\cocomo\src\com\adobe\rtc\sharedManagers\UserManager.as:1056]
    at com.adobe.rtc.sharedManagers::UserManager/onItemRetract()[C:\work\main\connect\cocomo\src\com\adobe\rtc\sharedManagers\UserManager.as:957]
    at flash.events::EventDispatcher/dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at com.adobe.rtc.sharedModel::CollectionNode/http://www.adobe.com/2006/connect/cocomo/messaging/internal::receiveItemRetraction()[C:\work\main\connect\cocomo\src\com\adobe\rtc\sharedModel\CollectionNode.as:755]
    at com.adobe.rtc.messaging.manager::MessageManager/http://www.adobe.com/2006/connect/cocomo/messaging/internal::receiveItemRetraction()[C:\work\main\connect\cocomo\src\com\adobe\rtc\messaging\manager\MessageManager.as:679]
    at com.adobe.rtc.session.managers::SessionManagerBase/receiveItemRetraction()[C:\work\main\connect\cocomo\src\com\adobe\rtc\session\managers\SessionManagerBase.as:341]

TypeError: Error #1009: Cannot access a property or method of a null object reference.
    at com.adobe.rtc.pods::SimpleChat/onUserRemove()[C:\work\main\connect\cocomo\src\com\adobe\rtc\pods\SimpleChat.as:693]
    at flash.events::EventDispatcher/dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at com.adobe.rtc.sharedManagers::UserManager/userRemoved()[C:\work\main\connect\cocomo\src\com\adobe\rtc\sharedManagers\UserManager.as:1056]
    at com.adobe.rtc.sharedManagers::UserManager/onItemRetract()[C:\work\main\connect\cocomo\src\com\adobe\rtc\sharedManagers\UserManager.as:957]
    at flash.events::EventDispatcher/dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at com.adobe.rtc.sharedModel::CollectionNode/http://www.adobe.com/2006/connect/cocomo/messaging/internal::receiveItemRetraction()[C:\work\main\connect\cocomo\src\com\adobe\rtc\sharedModel\CollectionNode.as:755]
    at com.adobe.rtc.messaging.manager::MessageManager/http://www.adobe.com/2006/connect/cocomo/messaging/internal::receiveItemRetraction()[C:\work\main\connect\cocomo\src\com\adobe\rtc\messaging\manager\MessageManager.as:679]
    at com.adobe.rtc.session.managers::SessionManagerBase/receiveItemRetraction()[C:\work\main\connect\cocomo\src\com\adobe\rtc\session\managers\SessionManagerBase.as:341]

1 Accepted Solution

Avatar

Correct answer by
Former Community Member

Hi,

Why do you need to use the same instance of authentication for every connectsession. I think you should use separate authenticators to authenticate and start a session. Looking at the MultipleSessions example in sampleApps folder.

Once you have a connectsession, you can use it for various components outside session containers.

Hope this helps.

Thanks

Hironmay Basu

View solution in original post

5 Replies

Avatar

Employee

Hi,

I tried to simulate the scenario you mentioned and didnt hit the exceptions you encountered. I am guessing you are mannually removing or booting the users out of the room before closing the app that might be leading to exceptions you posted.

Can you post your code if possible..

Thanks

Arun

Avatar

Level 3

Hi Arun

Thanks for your response. I have done a little debugging and have found that the issue only occurs if both players are logged in to the two sessions (ie. The lobby is the first and then the game is the second.) I also tried removing the SimpleChat and this had no effect. My guess is that it relates to the internal workings of the UserManager ie. maybe a cleanup routine when a user is removed.... but then again maybe I have an event that gets fired before the userRemove event ( I don't think so but I might try some more debugging later ).

Here is a bit more info about the scenario (if you can easily replicate this that would be great - it took me a while):

Session 1: The lobby contains a roster and a SimpleChat (In a ViewStack). It uses a SharedCollection to manage game challenges.

Session 2: The game contains a roster, SimpleChat. It uses a SharedProperty to identify opponents and a SharedCollection to store game data. A BatonProperty is also used.

  1. User #1 logs in to Session #1 as a guest (auto-promote)
  2. User #2 logs into Session #1 as a guest (auto-promote)
  3. User #1 challenges User #2 by clicking on the roster Item. A challenge SharedCollection transmits challenge information.
  4. User #2 receives an alert to accept the challenge. Clicks OK.
  5. An external HTTP request occurs which creates a game room if it is not already there. If successful User #2 receives a positive XML response.
  6. User #2 then logs into Session #2 and adds a new challenge item (containing room details etc.) for User #1
  7. User #1 then logs into Session #2

Avatar

Level 3

So now I am thinking the error comes from using the same AdobeHSAuthenticator for both sessions.

Perhaps someone could shed some light as to whether this is allowable (ie. using the same authenticator in multiple sessions)?

I would test it myself but have got account-time-limit-reached ... I am a bit surprised to have gone beyond quota as I have only been testing thus far.

Avatar

Level 3

Hi Arun

I have attached a text file which contains all the session login and authentication code.

Please advise if you can improve on it or can identify any key issues.

It would be cool if everyone could add their little bit, remembering to share their additions for re-use (it would be nice to have a basis for lobbying and separate game rooms, rather than rely on suggestion)

Thanks

Oliver

Avatar

Correct answer by
Former Community Member

Hi,

Why do you need to use the same instance of authentication for every connectsession. I think you should use separate authenticators to authenticate and start a session. Looking at the MultipleSessions example in sampleApps folder.

Once you have a connectsession, you can use it for various components outside session containers.

Hope this helps.

Thanks

Hironmay Basu

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