Is it possible to auto join specific user into specific match from backend?

Hi,

We are implementing a feature to auto create match and let some users join it at the moment.

Is it possible to add a Nakama RPC that behaviour acts like client.MatchJoinAsync that enable backend to auto join some users into match and trigger nk.MatchJoin & nk.MatchJoinAttempt?

Thanks.

Hi, @renhades!

You can build custom RPC with any behaviour you desire and make the client call it when desired. Check this link on how to register a custom RPC.

In your case the RPC could make the user join a match. Just make sure you call the proper Nakama functions, in both client and server, so resources are handled properly.

Hope this helps.

Cheers,
Caetano

Hi,

Sorry for my misleading description. It’s simple to know how to add custom RPC (thanks for the clear documents).

I want to let server acts like client. To login user and join match like:

  1. login user by AuthenticateCustom from backend
  2. provide match_id and then help join the user into match (trigger MatchJoin at the moment) from backend

Nakama provide a runtime.Match.MatchJoin that developer can trigger it from backend, but seems it need a state as parameter. Is it possible or proper to call it from a custom RPC?
Or there is another recommended ways to implement user-join-match to trigger Nakama MatchJoin?

Thanks.

Hi!

Maybe the Matchmaker feature can fit in your use case. Also, beware that authentication should not be done on the backend. If your game does not require auth, it could use Device Auth feature.

Hope to have shed a light :wink:

Cheers,
Caetao

Hi,

Seems the documentation mentioned is using Client but the question is I want to help player join match and trigger nk.MatchJoin as the player from backend.

Thanks.

Hi!

For a client/user to join a match it needs to be done client-side by calling an server-side API. Maybe you can have a “thread” on your game doing this, without user intervention…

Cheers,
Caetano