question

hendra avatar image
hendra asked

Specifying lobbyID for matchmake, return null for serverhostname

Hi, i'm trying to make a reconnect system.

1. The user disconnects, so the server update the user data by calling UpdateUserData and inputs the lobby_id

1. The user tries to reconnect by calling matchmake

2. The user input the lobby_id for the matchmake call

3. The result is a success. But all of the result is null (serverhostname, lobbyId, ticket).

My question is

1. Why do i get null when i try to call matchmake with a specified lobby_id ? i can't access the serverHostName, lobby_id, ticket, etc

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

brendan avatar image
brendan answered

Can you send the details of the request you're making (with parameters) and the response? If you're specifying a Lobby ID and you get a null back, that should mean that the lobby in question is no longer available.

5 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

hendra avatar image hendra commented ·

Now i tried it with postman. and this is the result

The first time user call Matchmake

    "code": 200,
    "status": "OK",
    "data": {
        "LobbyID": "13118676572333275966",
        "ServerHostname": "13.227.184.46",
        "ServerIPV6Address": "2406:da18:8eb:d101:1b54:163a:70d8:1243",
        "ServerPort": 9000,
        "Ticket": "49B1D49EA936CE53-0-A8C1F277C08EB36F-739C-8D5898786E1B547-s9pcDhzG65jLyvbx8J3tF+oxNG5Z7Lx0VVrxgZOmsPE=",
        "Expires": "2018-03-14T08:44:31.9322439Z",
        "Status": "Complete"
    }

After that, i wait for about 10s, and call matchmake again with these parameters:

- buildVersion

- region

- gameMode

- lobbyId

- startNewIfNoneFound (false)

and this is the result

    "code": 200,
    "status": "OK",
    "data": {
        "Status": "SessionClosed"
    }

even though it's still active in the active tab

0 Likes 0 ·
hendra avatar image hendra commented ·

Hi, i found out the problem

When the first player join a server, in my code, there's a countdown from 10 second.

If it reach 0 and no one else joins the room, the server will spawn 5 bot to fill the room (1 user & 5 bot). And also, the server call SetGameServerInstanceState to Closed (because i don't want other random player joining the game which already started).

Now when the only real player disconnects. And tries to reconnect by calling matchmake with specified lobby_id. in the postman, i got

    "code": 200,
    "status": "OK",
    "data": {
        "Status": "SessionClosed"
    }

So what is the best practice for this? I thought by specifying the lobby_id, i will still get the lobby data?

0 Likes 0 ·
brendan avatar image brendan hendra commented ·

Ah, I see - and thanks, I hadn't realized we had outdated info in those old posts, so I've updated them to correct things. No, if the server state is set to Closed, it is not returned on any Matchmake call. In part, this is because there are multiple ways for a player to discover info on running servers, so the Closed state is there to allow the server to say "return nothing from Matchmake for me". You'd need the client to either use the cached info on the server, or look it up another way (a custom matchmaker, or the GetCurrentGames API call).

0 Likes 0 ·
hendra avatar image hendra brendan commented ·

So what i did is when the user disconnect from the server, the server will cached the data (serverHostName, lobbyId, and ticket) to the user's playfab data (UpdateUserData).

When the user tries to reconnect. i just call the matchmake API call with serverHostName, lobbyId, and ticket from the user's playfab data. But the ticket can't be redeem because it's already redeem the first time user join the server. and matchmake api call when the room state is closed is not sending any new ticketId

So how to reconnect to a server which is CLOSED via SetGameServerInstanceState when the ticketId is already redeemed and i can't get a new one ?

0 Likes 0 ·
Show more comments
hendra avatar image
hendra answered

From your explanation, what i can interpret is this.

1. User join server by calling matchmake, the server store the playfabId for each user

2. When the user disconnect (closes the game), the server cached the serverHostname, lobbyId, and ticketId to the user's playfab data

3. The user open the application again, and logged in from the main menu scene (and the user cached the session ticket).

4. The user check if there's a serverHostName, lobbyId, ticketId in the user's playfab data.

5. then i have to MANUALLY load the game scene and set the network address etc for that client (because i can't use matchmake again because the state is closed).

6. After that's done (load the game scene and set all of the network address, etc), the user send their session ticket (which the user get from login) to the server.

7. Then the server calls AuthenticateSessionTicket.

8. If it's valid, then i spawn a character for that user, if not the server will kick that user from the server.

My questions are

1. Is that the correct way?

2. By calling matchmake and successfully redeem the ticket (for the first time / not reconnect), will AuthenticateSessionTicket return valid when the disconnected user tries to reconnect by sending the session ticket ?

2 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

brendan avatar image brendan commented ·

No, I'm only recommending saving the server IP and Port, so that you can try to re-connect. And that's the same data the Matchmake call returns, so there would be no difference between using the data from the Matchmake call versus the data you're saving in the player account, in making the connection. It's just that you don't have a matchmaker ticket, so you're telling the server "here's my Session Ticket, to prove who I am, since I was in this server before".

But I'm not sure what you mean in your second question. The first time, when the server isn't closed, you call Matchmake and send the matchmaker ticket to the server. That's what tells the server that the player legitimately joined the server from a matchmaking call. You only use AuthenticateSessionTicket in the case where you're re-joining the server.

0 Likes 0 ·
hendra avatar image hendra brendan commented ·

Ah i see.
Thanks for the detailed explanation Brendan!

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.