Thursday, 18 May 2017

API dev : Advice for Unity to loopback http transfer process

I'm curently developing an API to be use from a multiplatform Unity game. I need to transfer data from the client to my databese server.

My question is relative to the client to server communication. What is the best way to communicate? - With fields - With one raw data passing json object.

I'm using loopback.io

For now, I'm doing everything with field because my HTTP Plugin is doing wired stuff with my string during encoding and I don't succeed to read it with express.js.

I'am expected more advices about good pratice/ way to proceed

Here one of my receiver function with on my point of view way to many arguments.

  ApiElement.createSimpleElement = function(IdGameData, PositionX, PositionY, PositionZ, RotationY, RotationZ, Layer,
                                        Type, Gravity, Health, MoveSpeed, FireSpeed, cb) {
var data = FillElement(IdGameData, PositionX, PositionY, PositionZ, RotationY, RotationZ, Layer, Type, Gravity,
  Health, MoveSpeed, FireSpeed);
// Create the element
ApiElement.create(data, function(err, ApiElementInstance) {
  if (err) {
    cb(err, null);
  } else {
    console.log(ApiElementInstance);
    cb(null, ApiElementInstance);
  }
});

};



via Etienne Bernoux

No comments:

Post a Comment