Hi! I’m new to Nakama so forgive me if this has been addressed somewhere else.
I have a Unity game with a .NET Core REST backend that will connect to Nakama. Ex:
Client => Backend (with nakama SDK) => Nakama
I am not finding a way to send the session to the client and then for the client to send it back to the Backend for calling rpcs.
I thought that serializing the session to send it as a string to the client and then deserializing it back will work, but Nakama.Session does not have a constructor.
var session = Task.Run(async () =>
{
var session = await Client.AuthenticateDeviceAsync(deviceId);
return session;
}).Result;
return JsonConvert.SerializeObject(session);
And when I get a call from Unity:
var nakamaSession = JsonConvert.DeserializeObject<Nakama.Session>(session);
var objects = Task.Run(async () =>
{
return await Client.ReadStorageObjectsAsync(nakamaSession,
new[] { new StorageObjectId() { Collection = collection, Key = key, UserId = nakamaSession.UserId } });
}).Result;
Nakama.Session does not have a constructor, so that fails.
Is there a way to achieve this? Is there a better patter for this kind of case?
Thanks.-