Hi,
I've a a problem with the syncronisation of a remote so.

The aim of the so is to store the list of the users connected to my application.

When a client connect to my application, it receives the content of the so, but
other client don't receive the new entry.

I don't understand why :(


This is my server-side code:

Application.java

public class Application extends ApplicationAdapter {
 
  public String user_name;
  public boolean appConnect(IConnection conn, Object[] params){
           user_name=(String)params[0];
           Red5Debug.printDebug(user_name, "log.txt");
           Red5Debug.printDebug(Red5.getConnectionLocal().getClient().getId(), 
"id.txt");
   
            ISharedObject so = 
getSharedObject(Red5.getConnectionLocal().getScope(),"usersSO",true);
           so.addSharedObjectListener(new SampleSharedObjectListener());
           so.beginUpdate();
           
so.setAttribute(user_name,Red5.getConnectionLocal().getClient().getId());
           so.endUpdate();
       return true;
  }
 
}

SampleSharedObjectListener.java

public class SampleSharedObjectListener implements ISharedObjectListener {

 public void onSharedObjectUpdate(ISharedObject so, String key, Object value) {
  // The attribute <key> of the shared object <so>
  // was changed to <value>.
 }

   public void onSharedObjectDelete(ISharedObject so, String key) {
       // The attribute <key> of the shared object <so> was deleted.
   }

   public void onSharedObjectSend(ISharedObject so,
                                  String method, List params) {
       // The handler <method> of the shared object <so> was called
       // with the parameters <params>.
   }

 public void onSharedObjectClear(ISharedObject arg0) {
  // TODO Auto-generated method stub
  
 }

 public void onSharedObjectConnect(ISharedObject arg0) {
  // TODO Auto-generated method stub
  
 }

 public void onSharedObjectDisconnect(ISharedObject arg0) {
  // TODO Auto-generated method stub
  
 }

 public void onSharedObjectUpdate(ISharedObject arg0, IAttributeStore arg1) {
  // TODO Auto-generated method stub
  
 }

 public void onSharedObjectUpdate(ISharedObject arg0, Map<String, Object> arg1) 
{
  // TODO Auto-generated method stub
  
 }

   
}


Client side Code:

var nc:NetConnection;
nc = new NetConnection();

nc.onStatus = function(info){

  if (info.code == "NetConnection.Connect.Success") {
            trace(info.code)
            var usersSO:SharedObject = new SharedObject();
            usersSO = SharedObject.getRemote("usersSO", nc.uri, true);
   
            usersSO.onSync = function(list) {

                    for (var n in list) {   
                        var base_obj = this.data[list[n].name];
                        var base_obj_value = list[n].name;
                     
                        db_txt.htmlText+="Name: "+ base_obj +"<br> Value: "+ 
base_obj_value+"<br>___________";
                         trace("Name: "+ base_obj +"\n Value: "+ 
base_obj_value+"\n___________");
                     }
            };
            usersSO.connect(nc);
        } else {
            trace("ERROR: " + info.code);
        }

}

function doConnect(){
 nc.connect("rtmp://localhost/demo/test",_root.user_txt.text);
 
}


Thanks in advance,
Daniela

 
 


_______________________________________________
Red5 mailing list
[email protected]
http://osflash.org/mailman/listinfo/red5_osflash.org

Reply via email to