I am storing usenames in BigDB for users that come from Kongregate. I am accessing the value stored in BigDB on the server side, and then passing that value, the username, as a string back to the client side. For some reason, the string value coming through on the client side isn't what is being passed by the server side. In fact its completely different.
I have tried checking the values coming through from BigDB on the server side, and they are in fact pulling the correct username string out of BigDB. Once I have that value I immediately pass it to the client so it can put it up on the screen for other users to see on the match screen that players view while waiting to start a game.
Here is my server side code:
- Code: Select all
Message m2 = Message.Create("ChatInit");
foreach(Player p in this.Players)
{
String checkName = p.ConnectUserId;
String newName = "";
if (checkName.StartsWith("simple"))
{
p.isFromKongregate = false;
PlayerIO.BigDB.Load("playerObjects", p.ConnectUserId, delegate(DatabaseObject result)
{
newName = result.GetString("username");
p.username = newName;
});
}
else
{
p.isFromKongregate = true;
PlayerIO.BigDB.Load("kongPlayers", p.ConnectUserId, delegate(DatabaseObject result)
{
newName = result.GetString("kongUsername");
p.username = newName;
});
}
m2.Add(p.Id, newName);
}
player.Send(m2);
And here is the corresponding handler in the flash client side:
- Code: Select all
connection.addMessageHandler("ChatInit", function(m:Message){
for( var a:int=1;a<m.length;a+=2)
{
matchScreen.addUser(m.getString(a),m.getString(a+1));
}
})
The string value stored in BigDB that I am trying to access:
"mgray417"
The resulting string value coming back from the server that the client receives:
"kong5781093"
The "kong5781093" value happens to be the BigDB objects key, (as well as my kongregate userid, which is why i am using a separate DB for kongregate users), so I thought maybe that the server side is actually passing the object as opposed to the String value maybe, but that's just not the case.
So basically by the time the client receives the message from the server, it is a completely different string somehow.
I have tried tracing everything out in the client when it comes back, as well as adding an error log entry for the strings on the server before they are sent, still no idea how this is happening.
Any help would be GREATLY appreciated! Please don't delete this thread mods!
Thanks,
Mike