Nakama returns "Match not found"

its a local nakama server.
i try to connect to the create match with matchId
i create server with this:


       public async void CreateServer(string matchName)
        {
            _socket = Socket.From(_client); // _client.NewSocket(true);
            await _socket.ConnectAsync(_session);
            var match = await _socket.CreateMatchAsync(matchName);
            Debug.Log(match.Id);
            InitPresence(match);
            InitMessageEvents();
        }

and try to connect with this:

     public async void JoinMatch(string matchName)
        {
            _socket = Socket.From(_client);
            await _socket.ConnectAsync(_session);
            
            
            
            Debug.LogWarning($"joining match:{matchName}");
            var match = await _socket.JoinMatchAsync(matchName);

            InitPresence(match);
            InitMessageEvents();
        }

but it always says that the match is not found. what is the reason?

i think its the related log on the server side:

nakama-1  | {"level":"debug","ts":"2024-11-13T15:32:43.706Z","caller":"server/pipeline.go:65","msg":"Received *rtapi.Envelope_MatchJoin message","uid":"d9fa283d-3947-4058-bd26-023b61dd9c30","sid":"86ae4d66-a1d4-11ef-8c45-006100a0eb06","cid":"1","message":{"MatchJoin":{"Id":{"MatchId":"f930b29e-7f88-5f87-9a29-15a1b677b0b7.​"}}}}
nakama-1  | {"level":"debug","ts":"2024-11-13T15:32:43.708Z","caller":"server/session_ws.go:394","msg":"Sending error message","uid":"d9fa283d-3947-4058-bd26-023b61dd9c30","sid":"86ae4d66-a1d4-11ef-8c45-006100a0eb06","payload":"eyJjaWQiOiIxIiwgImVycm9yIjp7ImNvZGUiOjQsICJtZXNzYWdlIjoiTWF0Y2ggbm90IGZvdW5kIn19"}

Hello @virtouso,

For named matches both clients should call CreateMatchAsync with the same matchName.
The Join API is for Authoritative or Relayed matches created without a name.

Hope this clarifies.

1 Like