I am sending the following data on the server.
var loc = {
type : 'exloc',
ms : this.var1.move,
ppx : this.var1.ppx,
ppy : this.var1.ppy,
Name : "red",
rid : this.gv.GlobalInfoHolder.CurrentRoomID
};
and I can send this data in the following form also.
var obj = "type=exloc,ms="+this.var1.move+",ppx="+this.var1.ppx+",ppy="+this.var1.ppy+",Name=red,rid="+this.gv.GlobalInfoHolder.CurrentRoomID;
Then I can strip
the data based on the comma's I've put.
Another way would be to encode the object to json
then send the data to server and decode.
So I wanted to ask that what will be the best solution for this? It would be better if anyone tells me how to analyze the size in bytes of each of these variables including the json solution also.
I want to go for the solution that gives me the smallest size of the variable.I am doing this for performance and efficiency if anyone wants to suggest something he/she is most welcome.I am considering this because I am working on a real time game which has to share data between client and server very quickly (in milliseconds)