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

Sync Event after reconnect.

Avatar

Level 2

1. Unsubscribe, Close CollectionNodes.

2. Logout user with session.logout()

3. Login user.

4. Create CollectionNode. AddEventListener on Sync Events.

5. No Event.

Is it bug? Ot maybe I should now to totally logout client.

this.rtcService.releaseSubscribers();
this.rtcService.close();
this.sessionService.close();

RTCService - releaseSubscribers

if (_webcamSubscriber != null) {
     _webcamSubscriber.removeEventListener(StreamEvent.STREAM_DELETE, onCompanionStreamDelete);
     _webcamSubscriber.removeEventListener(StreamEvent.STREAM_PAUSE, onCompanionStreamPause);
     _webcamSubscriber.close();
     _webcamSubscriber = null;
}

RTCService - close

_userManager = null;
_userDescriptor = null;

_collectionVacantUsers.removeEventListener(CollectionNodeEvent.SYNCHRONIZATION_CHANGE, onSyncCollectionNode);
_collectionVacantUsers.unsubscribe();
_collectionVacantUsers.close();
_collectionVacantUsers = null;

_collectionChat.removeEventListener(CollectionNodeEvent.ITEM_RECEIVE, onItemReceiveChatCollectionNode);
_collectionChat.unsubscribe();
_collectionChat.close();
_collectionChat = null;

_webcamPublisher.removeEventListener(Event.CHANGE, onWebcamChange);
_webcamPublisher.close();
_webcamPublisher = null;

_connectionTimeout.removeEventListener(TimerEvent.TIMER, onConnectionTimer);
_connectionTimeout.removeEventListener(TimerEvent.TIMER_COMPLETE, onConnectionTimerComplete);
_connectionTimeout.reset();
_connectionTimeout = null;

SessionService

public function close() : void {
     this.registerSession(null);
}

public function registerSession($session : ConnectSession) : void {
     if (_session != null) {
          _session.removeEventListener(SessionEvent.SYNCHRONIZATION_CHANGE, onLogin);
          _session.logout();
          _session.close();
     }

     _session = $session;

     if (_session != null) {
          _session.addEventListener(SessionEvent.SYNCHRONIZATION_CHANGE, onLogin);
          _session.login();
     }
}

Event doesn't fire

CollectionNodeEvent.SYNCHRONIZATION_CHANGE, onSyncCollectionNode

1 Accepted Solution

Avatar

Correct answer by
Employee

Hi Nicolas,

I am guessing its the same issue again. Can you assign a session to _webCamSubscriber too.

So what is happening in your case is that, when you dont assign a session to your collectionNodes & other LCCS components, they use the first default connectSession called the primarySession.

So when you login and logout the first time, you are logging out of your primaryConnectSession. On subsequent login's your components are inactive as your primarySession is inactive.

So the code below might fix your issue, if not can you post your entire src as it helps us provide you faster response.

_webCamSubscriber.connectSession = _session;

Thanks

Arun

View solution in original post

8 Replies

Avatar

Former Community Member

Hi there,

Sorry, that was really confusing. I don't see everything from 1-5 in your

code, but I see a ton of other stuff in your code. Could you narrow this

down please?

thanks

nigel

Avatar

Level 2

After relogin, CollectionNode doesn't fire Sync event.

_collectionVacantUsers = new CollectionNode();
_collectionVacantUsers.sharedID = "VacantUsers";
_collectionVacantUsers.addEventListener(CollectionNodeEvent.SYNCHRONIZATION_CHANGE, onSyncCollectionNode);
_collectionVacantUsers.subscribe();

Event listener:

private function onSyncCollectionNode(e : CollectionNodeEvent) : void {
     if (_collectionVacantUsers.isSynchronized) {
          CONFIG::DEBUG {
               MonsterDebugger.trace(this, "VacantUsers synced and ready to use", "", "", DebugColors.SERVICE);
          }

          ...

     }
}

Avatar

Employee

From your code, you are never logging out.

public function registerSession($session : ConnectSession) : void {
     if (_session != null) {
          _session.removeEventListener(SessionEvent.SYNCHRONIZATION_CHANGE, onLogin);
          _session.logout();
          _session.close();
     }

     _session = $session;

     if (_session != null) {
          _session.addEventListener(SessionEvent.SYNCHRONIZATION_CHANGE, onLogin);
          _session.login();
     }
}


From a cursory glance, the could should be modifed to

public function registerSession($session : ConnectSession) : void {
     if (_session == null) {
          _session.removeEventListener(SessionEvent.SYNCHRONIZATION_CHANGE, onLogin);
          _session.logout();
          _session.close();
     }

     _session = $session;

     if (_session != null) {
          _session.addEventListener(SessionEvent.SYNCHRONIZATION_CHANGE, onLogin);
          _session.login();
     }
}

Avatar

Level 2

Are you sure?

It logouts ok. I see it in logs and Room console.

Avatar

Level 2

 this.registerSession(null);


resets _session if it exists already.

Avatar

Employee

Hi Nicolas,

I am making guesses from the code I am reading.

So assigning a session to your _collectionVacantUsers should fix the issue. I am making this guess, since you are sure that you succesfully logging in and out of your room, and its CollectionNodeEvent.SYNCHRONIZATION_CHANGE that is  not being fired.

_collectionVacantUsers.connectSession = _session;

Thanks

Arun

Avatar

Level 2

Thanks it works, but i have now another issue.

TypeError: Error #1009: Cannot access a property or method of a null object reference.
     at com.adobe.rtc.sharedManagers::StreamManager/get isP2P()
     at com.adobe.rtc.collaboration::WebcamSubscriber/createNetStream()
     at com.adobe.rtc.collaboration::WebcamSubscriber/playStream()
     at com.adobe.rtc.collaboration::WebcamSubscriber/set publisherIDs()

It is error after reconnect.

Avatar

Correct answer by
Employee

Hi Nicolas,

I am guessing its the same issue again. Can you assign a session to _webCamSubscriber too.

So what is happening in your case is that, when you dont assign a session to your collectionNodes & other LCCS components, they use the first default connectSession called the primarySession.

So when you login and logout the first time, you are logging out of your primaryConnectSession. On subsequent login's your components are inactive as your primarySession is inactive.

So the code below might fix your issue, if not can you post your entire src as it helps us provide you faster response.

_webCamSubscriber.connectSession = _session;

Thanks

Arun