Nakama official client

Hey guys, first of all I want to say that Nakama is AWESOME. Being able to write server code in lua has enabled me to set up a simple realtime multiplayer game quickly. This is so much fun.

I bumped into a small problem when attempting to join a match. Sending this from the client:

local metadata = {}
metadata.equipped_weapon_type = 1
local metadata_json = json.encode(metadata) -- {"equipped_weapon_type":1}
local message = nakama.create_match_join_message(match_id, token, metadata_json)

--[[
-- message:
{ 
  match_join = { --[[0x120d6fe00]]
    match_id = "9b8d2c60-25e5-4ddb-8e26-d0717d47dfb4.nakama-node-1",
    metadata = "{"equipped_weapon_type":1}"
  }
}
--]]

local result = nakama.socket_send(socket, message) -- This call fails

Results in this server error:

{"level":"debug","ts":"2021-03-12T14:29:54.210Z","msg":"Error reading message from client","uid":"4b4b9e18-8c26-4a62-a857-9f97f994ac7c","sid":"66a02717-d678-4b5a-9855-7f030c5136c1","error":"websocket: close 1006 (abnormal closure): unexpected EOF"}

If the metadata parameter is nil everything works as it should. I haven’t found any documentation about how the metadata should be formatted, hence this post. Any ideas?

3 Likes