SmartFox setUserVariables Problem

Post here all your questions related with SmartFoxServer .Net/Unity3D API

Moderators: Lapo, Bax

lordojazz
Posts: 17
Joined: 24 Jul 2008, 21:04

SmartFox setUserVariables Problem

Postby lordojazz » 28 Nov 2008, 14:15

Hi,

I'm having problems on using the setVariable, I can see that the users variable is been set but the event listener onsetUserVariblesUpdate is not being called...

Code: Select all

// java extension....

   @Override
   public void handleRequest(String _cmd, ActionscriptObject aso, User usr, int rm)
   {
      LinkedList<Object> li = new LinkedList<Object>();
      ActionscriptObject res = new ActionscriptObject();
   
      String uid = this.getUserInfo(usr.getName()).getItem("id");
      String chk = "SELECT * FROM members_avatars WHERE member_id = '"+uid+"'";
      trace(uid+"|"+usr.getName()+"|"+aso.get("avatar")+"|");
      ArrayList<DataRow> rs = db.executeQuery(chk);
      String v = (String) aso.get("avatar");
      
      if(rs.size() > 0)
      {
         String sql = "UPDATE members_avatars SET avatar='"+aso.get("avatar")+"' WHERE member_id='"+uid+"'";
         if(db.executeCommand(sql))
         {   
            usr.setVariable("a", v, "s");
            res.put("_cmd", "AvatarBroadcastOK");
         }
         else
         {
            res.put("_cmd", "AvatarBroadcastKO");
         }
      }
      
      li.push(usr.getChannel());
      sendResponse(res, rm, usr, li);
   }

// end java ext


// SmartfoxClient
_sfsH.addEventListener(SFSEvent.onUserVariablesUpdate, onUserVariablesUpdate, false, 0, true);

public function onUserVariablesUpdate(evt:SFSEvent):void
{
     trace('-------- onUserVariablesUpdate -------- ');
}

// end Client


nothing happens... is there any bug or problem... please help...

thanks
ThomasLund
Posts: 1297
Joined: 14 Mar 2008, 07:52
Location: Sweden

Postby ThomasLund » 29 Nov 2008, 07:51

If I recall correctly - Marco please correct me if I am wrong - then variable updates on the user that sent them are not returned back to him. You are supposed to update those yourself locally on sending them.

You can test it by enabling debug and see the raw messages send by the server in the log. If there is an XML message received on the socket with the data - and the callback is not triggered, then there is a bug. If nothing is recieved for the sending user, but for all others, then its a feature of SFS.

Return to “.Net / Unity3D API”

Who is online

Users browsing this forum: No registered users and 28 guests