Hello,
I am using Nakama Java SDK, however in java there is only:
client.rpc(session…) but not client.rpc(httpsercetkey…).
In unity, I often use client.RpcAsync(httpsercetkey…). Can Nakama Java SDK be updated further?
Thank you.
Hello @dhforever, we’d encourage you to open a PR to add support for this method if you can, contributions are greatly appreciated.
Best.
I really want to do that. But my experience is poor.
You can still call the RPC’s via REST using a regular Java HTTP client, you should add the http key as a query param called http_key
.
Hope this helps.
Thank you. I’m doing it.
Sorry for bothering you, can I ask something else besides this topic?
I don’t really understand the matchkick method yet, it is described below. How can a match owner kick another client out of that match?
let matchkick = function matchLoop(ctx, logger, nk, dispatcher, tick, state, messages) {
logger.debug('Lobby match loop executed');
dispatcher.matchKick(messages.map(function (message) {
return message.sender;
}));
return {
state: state
};
}
As in your example above, just call dispatcher.matchKick()
and pass the presence of the users to kick. Although in your example it seems like you’re kicking all clients that are sending a message to the match.
If you need a reference for how to implement match handlers, have a look at our project template.
There are no examples of Matchkick specifically. I searched them all.
Can you write an RPC function to kick 1 player with 1 userid from match?
There’s no example for kicking a player specifically, but you’d treat it like any of the other messages in the template.
First, define a message with an opcode to kick a player(s);
Then, have a case statement to handle the kick message. The client should send the list of players to kick in the payload of the message, you’d unmarshal it and call dispatcher.matchKick()
with the list of said players.
thank you. have a goodday