Expand my Community achievements bar.

SimpleChat breaks SYNCHRONIZATION_CHANGE

Avatar

Level 3

Hi,

Without SimpleChat I can login and logout several times and it works properly.

When I'm adding a SimpleChat pod, I on the second logout (after login, logout, login) I see the logout event but not the SYNCHRONIZATION_CHANGE event.

I'm creating a transient room with the recent php sdk.

The room prevent duplicateIDs.

I'm generating a token with the php sdk with a user with role=50.

To reproduce, please use the code below.

Without the SimpleChat pod:

1. Click on the login button - see the login message.

2. CLick on the logout button - see the logout message.

3. Click on the login button - see the login message.

4. Click on the logout button - see the logout message.

With the SimpleChat pod:

1. Click on the login button - see the login message.

2. CLick on the logout button - see the logout message.

3. Click on the login button - see the login message.

4. Click on the logout button - No logout message.

I'm displaying the login, logout and trace messages in the browser console (Firebug) but you can use the flash debugger instead.

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

<mx: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"

        xmlns:rtc="http://ns.adobe.com/rtc"

        width="400"

        height="600"

        applicationComplete="init()">

  <fx:Script>

    <![CDATA[

        import com.adobe.rtc.events.SessionEvent;

        import flash.external.ExternalInterface;

        import com.adobe.rtc.util.DebugUtil;

     

        [Bindable]

        private var roomURL:String;

        [Bindable]

        private var authToken:String;

        private function init(e:Event = null):void

        {

        removeEventListener(Event.ADDED_TO_STAGE, init);

       

        cSession.addEventListener(SessionEvent.SYNCHRONIZATION_CHANGE, onSynchronization);

        DebugUtil.traceFunction = traceMessage;     

        var paramObj:Object = LoaderInfo(this.root.loaderInfo).parameters;

        this.authToken = String(paramObj['token']);

        this.roomURL = String(paramObj['roomURL']);

        }

        private function traceMessage(message:String):void

        {

        ExternalInterface.call("console.log", message);

        }

       

        private function login():void

        {

        cSession.login();

        }

        private function logout():void

        {

        cSession.logout();

        }

        private function onSynchronization(e:SessionEvent):void

        {

        if (cSession.isSynchronized) {

            ExternalInterface.call("console.log", "login");

        } else {

            ExternalInterface.call("console.log", "logout");

        }

        }

    ]]>

  </fx:Script>

 

   

  <fx:Declarations>

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

  </fx:Declarations>

  <fx:Style>

  </fx:Style>

 

  <rtc:ConnectSessionContainer id="cSession"

                   autoLogin="false"

                   width="300"

                   height="300"

                   roomURL="{roomURL}">

    <rtc:authenticator>

      <rtc:AdobeHSAuthenticator requireRTMFP="true"

                protocol="RTMFP"

                authenticationKey="{authToken}">

      </rtc:AdobeHSAuthenticator>     

    </rtc:authenticator>

    <rtc:SimpleChat width="300" height="300" />

  </rtc:ConnectSessionContainer>

  <s:Button label="login" click="login()" />

  <s:Button label="logout" click="logout()" />

</mx:Application>

You can embed the above swf with the following code.

Please update the roomURL and token variables.

var flashvars = {roomURL: roomURL, token: token};

var params = {

        menu: "false",

        scale: "noScale",

        allowFullscreen: "true",

        allowScriptAccess: "always",

        bgcolor: "#FFFFFF"

};

var attributes = {};

swfobject.embedSWF("test.swf", "flash", "400", "600", "10.3.0", "expressInstall.swf", flashvars, params, attributes);

Thanks

0 Replies