Couldn't pass payload via Unity Client with http_key

I want to pass payload to RPC func in Unity with http key.

This is C# code
var apiRpc = await client.RpcAsync(httpKey, "test", "{\"Val\": \"a\"}");

But payload string is always empty in go module.

When I use curl like this
curl "<http key>" -d '"{\"Val\": \"a\"}"' -H 'Content-Type: application/json' -H 'Accept: application/json'

Go module get correct payload.

When I use ISession with client.RpcAsync, it work fine.
But I need to call rpc func without login in some cases.

How do I pass payload string without session?

Hey @opus_kojiro. I think this could be a limitation in the Unity client sdk. Please can you open an issue or pull request for the feature:

I wonder it is nakama-dotnet’s issue.

In ApiClient.gen.cs
RpcFunc2Async() send parameter as GET.
But I couldn’t find the code reading payload parameter from query in go code.

Now I found a workaround of this issue by using HttpClient directly.
The payload parameter is unwrapped in go code. So need to enclose in parentheses.

I think adding “unwrap” parameter is useful in this case.
But I don’t know this is correct way…

Like this.

        var json = "\"{\\\"Val\\\": \\\"a\\\"}\"";   // this is unwrapped to {\"Val\": \"a\"} in go 
        // var json = "{\"Val\": \"a\"}";   // unwrap version

        using (var httpClient = new HttpClient())
            var content = new StringContent(json, Encoding.UTF8, "application/json");
            var accept = new MediaTypeWithQualityHeaderValue("application/json");

            var response = await httpClient.PostAsync("", content);
            // var response = await httpClient.PostAsync("", content);  // unwrap version


@opus_kojiro The unwrap argument was one we added recently to the server so its not covered yet in the client sdk. I think definitely open a feature request for an update to include it in the .NET client so we can provide it with Unity engine too. :+1: