Rejoin match

i want to register an rpc to check the player last match is active or not. if its active he and he has time (60 s) return a true to client side. but in rpc i cant access match state to check the status of matchs.
i store last match of player in user metadata.
the problem is i cant rich match status from match id.
at the end i want when every client come to game check his last match, if its active and he has time tell my client to should the reconnect or leave match buttons.
if you have better solution for this action, i like to know that.
im using typescript runtime latest version and unity client

Hey @Mohsen
In order to do this you will need to use match labels and with rpc to call listing of those:
So for instance when match is being created in its lable you can store:

  • match Id, or something to indeifty it

Then when you disconnect, and want to attempt to reconnect to it, you send request with that id and call api:
nk.match_list
if you can adjust its query to target specific match, if it is found it will return data, if not then well match has expired.

1 Like

server:

simply store match id on nakama storage,

client :

read saved match id and
try to join match,
if match closed or not found api throws WebSocketException with message:

Match not found

then you can remove match id