Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.
SOLVED

How to Access Room List question.

Avatar

Level 2

Hi,

What I'm trying to do is:

     1) Authenticate and login to the account

     2) Get the room list(if any)

     3) Validate if a certain room exists against the list room

So I login with success but the room list is always null.

I've checked the documentation, it seems to be straight forward but I can't make it work.

Does anyone have a sample code to do this?

Here's my code:

public function authenticateSuccess(event:AccountManagerEvent):void
        {
            trace("ROOM:  " + event.list);
            try{
                if(isMaster){
                    acctMgr.createRoom(roomName);
                }
                else {
                    return;
                }
            } catch(e:Error){
                e.message = "The room you're trying to create already exists!";
                throw e;
            }
        }

Thanks in advance.

Artour.

LordAlex Works Inc.

1 Accepted Solution

Avatar

Correct answer by
Employee

This doesn't really answers Nigel's question (are you doing this in the Flex client ? You can't unless you are the developer account owner).

Also, it's faster for you to call createRoom and catch/ignore the error instead of checking if the room exists first (it's always 1 server call vs. potentially two server calls if the room does not exists)

View solution in original post

5 Replies

Avatar

Former Community Member

Hi Alex,

Before we get into this topic, I'd like a little more detail as to why

you're doing this sort of work on the client =). Just so that we're clear,

unless you're building an administrative dashboard sort of application,

where the owner of the account wants something similar to the room console

app, OR this is for demo purposes only, this is not a usual use-case, and

may be a sign of danger.

If, for example, you're building a client application with owner

credentials embedded in it so that you can create rooms on-the-fly from the

client, I'd advise that you NEVER expose such an app to anyone other than

the person(s) with owner credentials. If not, those credentials can easily

be compromised.

Ok, I've likely lectured long enough =). I think you need to run a

"requestRoomList()" function to have AccountManagerEvent.ROOM_LIST_RECEIVE

event get dispatched here - is that what you're doing?

nigel

Avatar

Level 2

Thank you Nigel for the quick response and the lecture =P

What we're doing is creating a room on login so each publisher/subscriber have they're own room.

So we want to verify if the room exist before creating it so it doesn't throw an error.

Artour.

LordAlex Works Inc.

Avatar

Correct answer by
Employee

This doesn't really answers Nigel's question (are you doing this in the Flex client ? You can't unless you are the developer account owner).

Also, it's faster for you to call createRoom and catch/ignore the error instead of checking if the room exists first (it's always 1 server call vs. potentially two server calls if the room does not exists)

Avatar

Former Community Member

Yes, it seems as though you want me to lecture you some more... =). The

right design for what you're trying to do is as follows :

1) Your client (presumably logged in to your own server) calls your server

to ask to join a room.

2) Your server checks to see if this is ok (using whatever rules apply to

your app), and logs into LCCS as the OWNER.

3) Your server creates a room in LCCS with the server APIs (see chapter 6 of

the developer guide), and likely creates an authentication token for your

user(s). As raff says, if the room already exists, just ignore the error.

4) Your server returns the roomURL and (probably) the authentication token

to your client.

5) Your client logs into the room (usually) with the roomURL and auth token.

Hope that makes sense. If, however, you're publicly distributing a SWF

which logs in as the OWNER of the account in order to create rooms, I'm

going to personally hack your account and steal your developer credentials.

You've been warned =).

nigel

Avatar

Level 2

Thanks guys,

We were considering to ignore the error and you guys just confirmed it because technically it shouldn't even create a room with the same name with the implementation we used.

Don't worry Nigel we wont distribute anything with owner credentials publicly =P