I would like to kick out an online user from nakama while 2nd login. The way I do is send a nk.NotificationSend() to client and then nk.SessionDisconnect(). but I tested, the client may receive ISocket.Closed first without receiving any notification. Is there any way that “flush” all notifications or rpc call to make sure the network packages got sent before the websocket is closed? or anyone could suggest good way to kick user with error message to game client.
There is no way for the server to queue things and wait for them before disconnecting the socket as various operations of the server runs concurrently.
One alternative is to introduce a delay between sending notification and closing the socket on the Runtime code. This should help ensure message delivery to the client.
Also I suggest taking a look at this forum post:
Thank you, @mofirouz.
That’s what I have in mind now. a delay call SessionDisconnect().