Expand my Community achievements bar.

User Roles and Knocking Queue Clarification

Avatar

Former Community Member

Hi,

Need some clarification about Roles and Knocking Queue.

Am creatng a simple video chat app, for that i want to make queue management for my guests. Create this application using LCCS sample code, but getting user role as 5 for guest and it throws error, when autopromote is true.

The basic code am using for chat,

<?xml version="1.0" encoding="utf-8"?>

<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"

               xmlns:s="library://ns.adobe.com/flex/spark"

               xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600" xmlns:ns="http://ns.adobe.com/rtc">

    <fx:Declarations>

        <!-- Place non-visual elements (e.g., services, value objects) here -->

        <!--<ns:AdobeHSAuthenticator id="auth" 

                                  userName="USERNAME" 

                                  password="PASSWORD"

                                  protocol="rtmfp" />-->

        <ns:RoomSettings id="settings" autoPromote="true" />

       

        <ns:AdobeHSAuthenticator id="auth" userName="{gusetName}" protocol="rtmfp" />

    </fx:Declarations>

   

    <fx:Script>

        <![CDATA[

            [Binadle] private var gusetName:String = "Queue Testing";

            [Binadle] private var roomURL:String = "ROOMURL";

            [Binadle] private var pendingArray:Array;

            [Binadle] private var acceptedArray:Array;

            [Binadle] private var deniedArray:Array;

           

           

            import com.adobe.rtc.events.UserQueueEvent;

            import com.adobe.rtc.messaging.UserRoles;

            import com.adobe.rtc.sharedManagers.RoomManager;

            import com.adobe.rtc.sharedManagers.constants.UserStatuses;

            import com.adobe.rtc.sharedModel.UserQueue;

            import com.adobe.rtc.sharedModel.userQueueClasses.UserQueueItem;

            private function onCreationComplete():void


            {
                cSession.roomManager.autoPromote = true;
                cSession.roomManager.guestsHaveToKnock = true ;
                if ( cSession.userManager.myUserRole == UserRoles.OWNER )
                {                   
                    pendingArray = new Array();
                    var queue:Array = cSession.roomManager.knockingQueue.pendingQueue ;
                    for ( var i:int = 0 ; i < queue.length ; i++ ) {
                        var item:UserQueueItem = queue[i] as UserQueueItem ;
                        pendingArray.push({label:item.descriptor.displayName,descriptor:item.descriptor});
                    }
                    cSession.roomManager.knockingQueue.addEventListener(UserQueueEvent.ITEM_UPDATE,onKnockingQueueUpdate);
                }
                else
                {                   
                    knockingUI.visible = false;
                }
               
               
                if ( cSession.userManager.myUserRole == UserRoles.LOBBY )
                {
                    cSession.roomManager.knockingQueue.addEventListener(UserQueueEvent.ACCEPT,onMyAccept);
                    cSession.roomManager.knockingQueue.addEventListener(UserQueueEvent.DENY,onMyDeny);
                }
               
            }

            private function onKnockingQueueUpdate(p_evt:UserQueueEvent):void
            {
                pendingArray = new Array();                
                acceptedArray = new Array();
                deniedArray = new Array();
               
                var queue:Array = cSession.roomManager.knockingQueue.queue ;
               
                for ( var i:int = 0 ; i < queue.length ; i++ ) {
                    var item:UserQueueItem = queue[i] as UserQueueItem ;
                    if ( item.status == UserQueueItem.STATUS_PENDING ) {
                        pendingArray.push({label:item.descriptor.displayName,descriptor:item.descriptor});
                    }
                   
                    if ( item.status == UserQueueItem.STATUS_ACCEPTED ) {
                        acceptedArray.push({label:item.descriptor.displayName,descriptor:item.descriptor});
                    }
                    if ( item.status == UserQueueItem.STATUS_DENIED ) {
                        deniedArray.push({label:item.descriptor.displayName,descriptor:item.descriptor});
                    }
                   
                }               
            }

            private function onAcceptClick(p_evt:MouseEvent):void
            {
                if ( cSession.userManager.myUserRole == UserRoles.OWNER ) {
                    cSession.roomManager.knockingQueue.acceptUser(knockingList.selectedItem.descriptor.userID);
                }
            }

            private function onDenyClick(p_evt:MouseEvent):void
            {
                if ( cSession.userManager.myUserRole == UserRoles.OWNER )
                    cSession.roomManager.knockingQueue.denyUser(knockingList.selectedItem.descriptor.userID);
            }
           
           
           
            private function onMyAccept(p_evt:UserQueueEvent):void
            {
                knockingUI.visible = true;
                simpleChat.width = 300 ;
                simpleChat.height = 150 ;
            }
           
            private function onMyDeny(p_evt:UserQueueEvent):void
            {
                knockingUI.visible = false;
            }   
           
        ]]>
    </fx:Script>
   
    <ns:ConnectSessionContainer roomURL="{roomURL}"
                                id="cSession"
                                initialRoomSettings="{settings}"
                                authenticator="{auth}"
                                creationComplete="onCreationComplete()">
           
       
        <mx:VBox id="knockingUI">
            <mx:HBox  horizontalGap="15">
                <mx:VBox>
                    <mx:Label text="Pending User List" />
                    <mx:List id="knockingList" dataProvider="pendingArray" width="100%" height="200"/>
                    <mx:HBox>
                        <mx:Button label="accept" enabled="{knockingList.selectedItem}" click="onAcceptClick(event)" />
                        <mx:Button label="deny" enabled="{knockingList.selectedItem}" click="onDenyClick(event)"/>
                    </mx:HBox>
                </mx:VBox>
                <mx:VBox>
                    <mx:Label text="Accepted User List" />
                    <mx:List id="acceptedList" dataProvider="acceptedArray" width="100%" height="200" />
                </mx:VBox>
                <mx:VBox>
                    <mx:Label text="Denied User List" />
                    <mx:List id="deniedList" dataProvider="deniedArray" width="100%" height="200" />
                </mx:VBox>
            </mx:HBox>
            <mx:HBox>
                <ns:WebCamera />
                <ns:SimpleChat id="simpleChat" width="100%" height="100%"/>
            </mx:HBox>
        </mx:VBox>
    </ns:ConnectSessionContainer>
</s:Application>

Thanks,

anu

3 Replies

Avatar

Former Community Member

A knocking queue literally prevents entry into the room until an OWNER

allows them in (they are stuck with role 5 until such time). Is that what

you're trying to do? What is the error you're hitting?

nigel

Avatar

Former Community Member

Here is the stack trace:

Error: MessageManager.createNode : insufficient permissions to create node
    atcom.adobe.rtc.messaging.manager::MessageManager/http://www.adobe.com/2006/connect/cocomo/messaging/internal::createNode()[/Users/arun/Work/aponnusa_theoden.corp.adobe.com_1666/depot/branches/connect/1010/cocomoPlayer10.1/src/com/adobe/rtc/messaging/manager/MessageManager.as:273]
    atcom.adobe.rtc.sharedModel::CollectionNode/createNode()[/Users/arun/Work/aponnusa_theoden.corp.adobe.com_1666/depot/branches/connect/1010/cocomoPlayer10.1/src/com/adobe/rtc/sharedModel/CollectionNode.as:379]
    atcom.adobe.rtc.sharedModel::SharedProperty/onSynchronizationChange()[/Users/arun/Work/aponnusa_theoden.corp.adobe.com_1666/depot/branches/connect/1010/cocomoPlayer10.1/src/com/adobe/rtc/sharedModel/SharedProperty.as:571]
    atflash.events::EventDispatcher/dispatchEventFunction()
    atflash.events::EventDispatcher/dispatchEvent()
    atcom.adobe.rtc.sharedModel::CollectionNode/http://www.adobe.com/2006/connect/cocomo/messaging/internal::setIsSynchronized()[/Users/arun/Work/aponnusa_theoden.corp.adobe.com_1666/depot/branches/connect/1010/cocomoPlayer10.1/src/com/adobe/rtc/sharedModel/CollectionNode.as:700]
    atcom.adobe.rtc.messaging.manager::MessageManager/receiveAllSynchData()[/Users/arun/Work/aponnusa_theoden.corp.adobe.com_1666/depot/branches/connect/1010/cocomoPlayer10.1/src/com/adobe/rtc/messaging/manager/MessageManager.as:871]
    atcom.adobe.rtc.messaging.manager::MessageManager/http://www.adobe.com/2006/connect/cocomo/messaging/internal::receiveItems()[/Users/arun/Work/aponnusa_theoden.corp.adobe.com_1666/depot/branches/connect/1010/cocomoPlayer10.1/src/com/adobe/rtc/messaging/manager/MessageManager.as:616]
    atcom.adobe.rtc.session.managers::SessionManagerBase/receiveItems()[/Users/arun/Work/aponnusa_theoden.corp.adobe.com_1666/depot/branches/connect/1010/cocomoPlayer10.1/src/com/adobe/rtc/session/managers/SessionManagerBase.as:458]

Thanks

anu

Avatar

Former Community Member

Hi there,

I think you should watch the "Managing Roles and Permissions" videotutorial

included with the SDK. Looks as though your room isn't pre-populated with

the facilities needed.

nigel