Problem with Joining a Match

Hello everyone, i am new to nakama and trying to make a simple game with Unity.
i already read Documents, set Docker, etc … and played around with codes.
my problem is i can make a Match, but cant join :sob:

just copied from Sample, but it wont work :

This is how i Connect to Docker :

private IClient client;
private ISocket socket;

private async void Awake()
client = new Client("http", "", 7350, "defaultkey");
socket = client.NewSocket();
ISession session;
var session = await client.AuthenticateEmailAsync("", "3bc8f72e95a9");
Debug.LogFormat("New user: {0}, {1}", session.Created, session);

Create Match (This one Working) :

var match = await socket.CreateMatchAsync();
Debug.LogFormat("New match with id '{0}'.", match.Id);

Join Match(This One Dosen’t Work)

var matchId = "<matchid>";
var match = await socket.JoinMatchAsync(matchId);
foreach (var presence in match.Presences)
    Debug.LogFormat("User id '{0}' name '{1}'.", presence.UserId, presence.Username);

any help will be appreciated :bowing_man:

@Ali.p “doesn’t work” is a little too vague I’m afraid. Can you paste the exact error message or stacktrace that you get when trying to join the match?

hi , thanks for answer.
yeah, you are right, i forgot to send an errors.
the initial problem solved by snatch a code from sample project (joly roger).

using System.Collections;
using System.Collections.Generic;
using System.Net;
using Nakama;
using Nakama.TinyJson;
using UnityEngine;

public class MatchmakerWithMatch : MonoBehaviour
    private IClient _client = new Client("http", "", 7350, "defaultkey");
    private ISocket _socket;

    async void Start()
        var deviceid = SystemInfo.deviceUniqueIdentifier;
        // NOTE should cache a user session.
        var session = await _client.AuthenticateDeviceAsync(deviceid);
        Debug.LogFormat("Session '{0}'", session);

        _socket = _client.NewSocket();

        IUserPresence self = null;
        var connectedOpponents = new List<IUserPresence>(0);
        _socket.ReceivedMatchmakerMatched += async (matched) =>
            Debug.LogFormat("Matched '{0}'", matched);
            var match = await _socket.JoinMatchAsync(matched);
            self = match.Self;
            Debug.LogFormat("Self '{0}'", self);

            // NOTE shows how to send match state messages.
            var newState = new Dictionary<string, string> {{"hello", "world"}}.ToJson();
            await _socket.SendMatchStateAsync(match.Id, 0, newState); // Send to all connected users.
        _socket.ReceivedMatchPresence += (presenceChange) =>
            foreach (var leave in presenceChange.Leaves)
                connectedOpponents.RemoveAll(item => item.SessionId.Equals(leave.SessionId));
            // Remove yourself from connected opponents.
            connectedOpponents.RemoveAll(item => {
                return self != null && item.SessionId.Equals(self.SessionId);
        _socket.ReceivedMatchState += (message) =>
            var enc = System.Text.Encoding.UTF8;
            Debug.LogFormat("Match state '{0}'", enc.GetString(message.State));
        _socket.Connected += () => Debug.Log("Socket connected.");
        _socket.Closed += () => Debug.Log("Socket disconnected.");

        await _socket.ConnectAsync(session);

        int minCount = 2;
        int maxCount = 8;
        var matchmakerTicket = await _socket.AddMatchmakerAsync("*", minCount, maxCount);
        Debug.LogFormat("Matchmaker ticket '{0}'", matchmakerTicket);

    async void OnApplicationQuit()
        if (_socket != null)
            await _socket.CloseAsync();

i didn’t understand the concept of how to create and declare a match that time.
as i playing around with codes and reverse engineering the sample project, starting to understand more.

i will post more series problems later :smiley:

@Ali.p Sounds like you were able to solve the issue you had as you got started? Can you share the specific code that solved it for you. It would help me to know where our docs can be improved to make things clearer and easier. Thanks :pray: