Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

Dynamically switching rooms

Avatar

Avatar
Validate 1
Level 2
RickBullotta
Level 2

Likes

0 likes

Total Posts

34 posts

Correct Reply

2 solutions
Top badges earned
Validate 1
Affirm 1
View profile

Avatar
Validate 1
Level 2
RickBullotta
Level 2

Likes

0 likes

Total Posts

34 posts

Correct Reply

2 solutions
Top badges earned
Validate 1
Affirm 1
View profile
RickBullotta
Level 2

19-12-2008

Can someone walk me through the process of dynamically
connecting a SessionContainer/pod(s) to a new room "on the fly".



Many thanks,



Rick

Accepted Solutions (0)

Answers (5)

Answers (5)

Avatar

Avatar
Validate 1
Level 1
Rick_Bullotta
Level 1

Likes

0 likes

Total Posts

13 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
View profile

Avatar
Validate 1
Level 1
Rick_Bullotta
Level 1

Likes

0 likes

Total Posts

13 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
View profile
Rick_Bullotta
Level 1

23-12-2008

Hi, Nigel.



HTH. Rest assured, we'll try to do plenty of things you
haven't had a chance to try yet... 😉



Happy holidays,



Rick

Avatar

Avatar
Boost 50
Level 7
Nigel_Pegg
Level 7

Likes

103 likes

Total Posts

909 posts

Correct Reply

81 solutions
Top badges earned
Boost 50
Boost 5
Boost 3
Boost 25
Boost 100
View profile

Avatar
Boost 50
Level 7
Nigel_Pegg
Level 7

Likes

103 likes

Total Posts

909 posts

Correct Reply

81 solutions
Top badges earned
Boost 50
Boost 5
Boost 3
Boost 25
Boost 100
View profile
Nigel_Pegg
Level 7

23-12-2008



Hi Rick,



Interesting - the idea here definitely was for "close()" on
the SimpleChatModel to do the work here, and for you to be able to
call chatPod.subscribe() again, I appreciate the time you took to
figure out what wasn't working here - we'll definitely take what
you've hit here and make some improvements to the class to make
this smoother.



I love it when people start doing things with our classes
that we hadn't yet had time to try ourselves! Progress!



thanks

nigel

Avatar

Avatar
Validate 1
Level 1
Rick_Bullotta
Level 1

Likes

0 likes

Total Posts

13 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
View profile

Avatar
Validate 1
Level 1
Rick_Bullotta
Level 1

Likes

0 likes

Total Posts

13 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
View profile
Rick_Bullotta
Level 1

21-12-2008

Here's what I ended up using to make things work:



1. I created a class of my own called ExtendedSimpleChat,
which extends SimpleChat



2. I added an "unsubscribe" method (shown below) to this
class, which disconnects and destroys the existing model and
userManager instances in the SimpleChat class (and clears the
history and message input UI objects)



3. To switch rooms, I call the following methods (cSession is
the ConnectSessionContainer instance)



chatPod.unsubscribe();

cSession.logout();

cSession.roomURL = "new URL goes here";

cSession.login();



4. In the event handler for
SessionEvent.SYNCHRONIZATION_CHANGE, if the session is
synchronized, I call:



chatPod.subscribe();



This combination seems to work well. It would probably be a
good idea to add this unsubscribe method to the SimpleChat class.
The "close()" method in SimpleChat disconnects too many other
things.





-------------------------------------------------------------------------------------

public function unsubscribe() : void {

if (_model) {

_model.close();


_model.removeEventListener(CollectionNodeEvent.SYNCHRONIZATION_CHANGE,
onSynchronizationChange);

_model.removeEventListener(ChatEvent.HISTORY_CHANGE,
onHistoryChange);

_model.removeEventListener(ChatEvent.TYPING_LIST_UPDATE,
onTypingListUpdate);


_model.removeEventListener(ChatEvent.ALLOW_PRIVATE_CHAT_CHANGE,
onAllowPrivateChange);



_model = null;

}



if(_userManager) {

_userManager.removeEventListener(UserEvent.USER_CREATE,
dirtyUserList);

_userManager.removeEventListener(UserEvent.USER_REMOVE,
onUserRemove);

_userManager.removeEventListener(UserEvent.USER_ROLE_CHANGE,
onUserRoleChange);



_userManager = null;

}



_history.htmlText = "" ;

_newMessage.text = "" ;



}



Avatar

Avatar
Validate 1
Level 2
RickBullotta
Level 2

Likes

0 likes

Total Posts

34 posts

Correct Reply

2 solutions
Top badges earned
Validate 1
Affirm 1
View profile

Avatar
Validate 1
Level 2
RickBullotta
Level 2

Likes

0 likes

Total Posts

34 posts

Correct Reply

2 solutions
Top badges earned
Validate 1
Affirm 1
View profile
RickBullotta
Level 2

19-12-2008

Hi, Raff.



That's what I had already tried, but the pods don't re-synch
to the new room. In looking at the source for the chat pod, it
looks like the model doesn't get set to null on close/disconnect,
and this seems to be causing issues.



Unfortunately, the _model member is read-only (only provides
a getter) so I couldn't force it to null to see if that was the
issue.



Rick





Avatar

Avatar
Boost 50
Employee
Raff_
Employee

Likes

80 likes

Total Posts

758 posts

Correct Reply

75 solutions
Top badges earned
Boost 50
Boost 5
Boost 3
Boost 25
Boost 10
View profile

Avatar
Boost 50
Employee
Raff_
Employee

Likes

80 likes

Total Posts

758 posts

Correct Reply

75 solutions
Top badges earned
Boost 50
Boost 5
Boost 3
Boost 25
Boost 10
View profile
Raff_
Employee

19-12-2008

You can try:



sessionContainer.logout()

sessionContainer.roomURL = newRoomURL



// possibly change user new room owner

auth.userName = newUserName

aut.password = newPassword



// login into new room

sessionContainer.login()