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?
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.
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:
- login user by AuthenticateCustom from backend
- 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?
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
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.
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…