I'm working on upgrading my dev tools for Servers 2.0.
For calls like ShutdownMultiplayerServer and GetMultiplayerServerDetails
Why do we have to provide both the SessionId and the BuildId?
Isn't the SessionId unique? If so, isn't that enough to identify the session?
If there's something I'm missing, then, how can I retrieve the BuildId based on the SessionId?
For full context, I'm trying to create a command for remotely shutting down a server (something we could do in legacy multiplayer with just one button click in the PlayFab dashboard). I want to be able to type something like "shutdown de51953a9107b84e0fce3ad18a7545f8e37ee4b2d0ae38cd5677e02043ab6493" and it will shutdown that instance.
Answer by Citrus Yan · Aug 09, 2019 at 01:45 AM
Hi Brent, after a discussion with our team, we draw a conclusion that only the combination of SessionId and BuildId can identify a server session. The reason is that you can request a multiplayer server with the same SessionId on different builds, you can test it by calling RequestMultiplayerServer. So this is the reason why you have to provide both SessionId and BuildId to identify the session.
About retrieving the BuildId based on the SessionId, unfortunately PlayFab does not have such API to be able to do that. You can make a Feature Request about it though. However, we found that buildId and sessionId are both listed in the event “server_state_changed”, maybe you can retrieve those from it although I am afraid it’s hard for you to do it programmatically. Moreover, the amount of buildIds is much lesser compared to sessionIds , maybe you could try to enumerate them. If your sessionIds is random enough then statiscally the chance that you shutdown the wrong server is quite small although this will make many invalid calls.
From my point of view, I think Jason’s approach is quite economic and effective, you can consider about it.
By the way, One more thing that might helpful for you, we can use ListMultiplayerServers to get all server sessions for a build. You can use this to build your tool to shutdown the server instance with a specific session id.
Thanks - I'll be able to come up with a workable solution using ListMultiplayerServers. It was just unintuitive to me that SessionId would be non-unique, given that it has "id" in the name, but it sounds like that's the case.
Answer by jasonallen · Aug 08, 2019 at 06:01 PM
Microsoft::Azure::Gaming::GSDK::getConfigSettings() will give you all the info to make those calls. The dictionary keys can be found in: https://github.com/PlayFab/gsdk/blob/master/cpp/cppsdk/gsdk.h
However this would still need to be done via the server. My server queries the info and then stores it elsewhere so I can see the info whenever I need to make rest calls.
Thanks for the reply. Unfortunately I don't think this quite answers the question, because I am looking to call these APIs from a development tool, not from a running server instance.
What I was saying was that my server sends this data after starting up, then I have the info stored for rest calls that I do from dev tools. I think the reason this is required is to stop people from trying brute force rest calls to knock down your server.
hmm, I'm still confused :( can you describe your flow a little more specifically? Where do you send information to? Like some persistant data store, like redis or some backend database?
Custom game server instance (unity) does not start 1 Answer
How do I find the fields to input into RedeemMatchmakerTicket in UE4? 1 Answer
PlayFab Matchmaking with custom game servers 1 Answer
What is the recommended way to get the list of players in a match, from a game server? 2 Answers
Matchmaking flow with Unity 3 Answers