heroiclabs / nakama-defold

Defold client for Nakama server.
https://heroiclabs.com
Apache License 2.0
75 stars 12 forks source link

Added unwrap flag #27

Open alexandrecurtelin opened 3 years ago

alexandrecurtelin commented 3 years ago

Since Nakama v.2.7.0 an unwrap query parameter is supported which allows to invoke RPC functions with raw JSON data in the payload.

CLAassistant commented 3 years ago

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

CLAassistant commented 3 years ago

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

britzl commented 3 years ago

Thank you for the contribution. The change you made was in generated code and would be overwritten the next time the API is generated. I wonder how the unwrap option is applied in other Nakama clients. @novabyte ?

novabyte commented 3 years ago

@britzl We don't really bother to use the unwrap=1 option in RPCs because the client SDKs can all handle the implicit escaped JSON necessary to send the data to the server (due to the constraints of Protobuf). If we do decide to expose the unwrap version of the RPC method it will probably be lifted to the client object type in the various SDKs and its implementation will not expect to be generated by the codegen tool. Hope this all makes sense.

britzl commented 3 years ago

Thanks @novabyte . So you are saying that it doesn't make sense to add it to the API and instead let the client deal with it. @alexandrecurtelin does this make sense to you?

novabyte commented 3 years ago

@britzl My suggestion is to add a method directly to the nakama.lua module with the special overload for the version of RPC which uses unwrap rather than attempt to handle it within the codegen tool.