0 Replies Latest reply on Sep 24, 2009 11:56 PM by roshni79

    Flex Red5 SyncEvent

    roshni79

      Hello all,

       

      I am working with a video chat application using flex and Red5. On flex side, I am using cairngorm architecture and SyncEvent on shared object for broadcasting changes made in shared objects to all clients. I feel sometimes the sync events are getting fired and sometimes they are not. So I am getting an inconsistent behavior from my application. I am using defaultObjectEncoding as AMF3.

       

      I am not sure whether this should posted in Red5 forums or flex forums. Please excuse if I posted it in wrong place.

      I will be thankful if anyone can clarify me in the following situation: The situation does not represent my application. But if I am correct in this way, I could proceed to solve my problem.

       

      I have a client side flex application with 3 button controls

       

      Button1 connects to Red5 as URI = rtmp://localhost:1935/Myappl. On Red5 side, I will be modifiying serveral Map attributes in application scope AppTSO. In the result handler method, upon NetConnection.Connect.Success, I am firing a cairngorm event getApplTSOSyncEvent for getting data from application scope shared object AppTSO. Corresponding command class has the following code:

       

      var applTSO:SharedObject;       
      SharedObject.defaultObjectEncoding = model.objectEncodeType; //AMF3
      applTSO = SharedObject.getRemote("AppTSO", model.netConn.uri, false);
      applTSO.addEventListener(SyncEvent.SYNC, doOnSync);
      applTSO.connect(model.netConn);

       

      Using sync handler method, I am monitoring each Map attribute in shared object AppTSO and populate or change data on some flex controls.

       

      Button2 connects to Red5 in room scope as URI = rtmp://localhost:1935/Myappl/Room1001. In the result handler upon NetConnection.Connect.Success, I am firing a cairngorm event getRoomTSOSyncEvent for getting data from room scope shared object RoomTSO. Corresponding command class has the following code:

       

      var roomTSO:SharedObject;
      SharedObject.defaultObjectEncoding = model.objectEncodeType; //AMF3
      roomTSO = SharedObject.getRemote("RoomTSO", model.netConnRoom.uri, false);
      roomTSO.addEventListener(SyncEvent.SYNC, doOnSync);
      roomTSO.connect(model.netConnRoom);

       

      Using sync handler method, I am monitoring each Map attribute in shared object RoomTSO and populate or change data on some flex controls.

       

      Button3 calls a Red5 method in room scope and this method make changes to Map attributes from both application scope shared object AppTSO and room scope shared object RoomTSO. From Red5 console, I could see methods are getting called correctly on server. Now on flex side should I fire getApplTSOSyncEvent and  getRoomTSOSyncEvent once again in result handler of netConn.call method? or will they be fired automatically as I am registering them on NetConnection.Connect.Success handlers? I feel sometimes they are getting fired automatically and I could get shared object
      data on client and sometimes they won't.

       

      Is it like when we connect to applicaton scope or call a method in application scope, SyncEvent on application scope shared object applTSO is fired and when we connect to room scope or call a method in room scope, SyncEvent on room scope shared object roomTSO is fired?

      Please help me on this or point me to some links.

       

      Thanks all.

       

      roshni.