Client: nakama-js
Server: Nakama Typescript
Hi. How I can handle user kick from client side? I do not get any events after call dispatcher.matchKick([user]) from server side
Client: nakama-js
Server: Nakama Typescript
Hi. How I can handle user kick from client side? I do not get any events after call dispatcher.matchKick([user]) from server side
On the client side you can see kicks as matchPresenceEvent
. You can find example code in Nakama: JavaScript | Heroic Labs Documentation
Thanks for your answer but client lib 2.4.1 not have “matchPresenceEvent” handler, only " onmatchpresence" and this handler not firing when user kicked from match. This is the confusion and the reason for the question.
To help diagnose it further, could you confirm that socket is active and connected by calling socket.updateStatus("any string")
, then checking result on a client socket where you expect to receive kick notification.
And socket.onmatchpresence not firing
Which Nakama version are you using?
Client: nakama-js 2.4.1
Server: Nakama Typescript
package.json:
“dependencies”: {
“nakama-runtime”: https://github.com/heroiclabs/nakama-common
}
package-lock.json:
“nakama-runtime”: {
“version”: “git+https://github.com/heroiclabs/nakama-common.git#ff6a4e4f6a6d0f40025a405b1bc1fff60a9b549f”,
“from”: “git+https://github.com/heroiclabs/nakama-common.git”
},
Any ideas why socket.onmatchpresence not firing for kicked user after dispatcher.matchKick([user]) call?
onmatchpresence handler firing for everyone except the one who kicked
I was going to edit but accidentally deleted my post. Anyways, I was having this same issue inside of a match_loop when processing the messages.
While testing, I had a button upon clicking it would send match_data to the match, and as the messages are processed, I kicked the message sender. In this example, the message sender is me.
After further testing, it seems that you will only receive on_match_presence event if the kicked player is not the receiver of the event (e.g. someone else other than you got kicked). This would help update client state if someone got kicked. This is on Lua by the day. Not even sure if this is a valid scenario but something I have encountered while testing.
I guess you can always broadcast a message to the player been kicked with an op_code so you can handle client side.