Is there an event for game session termination?

0

Hello! I'm trying to migrate my current dedicated server from playfab to gamelift, and Playfab had an event for session closing, that I could catch in cloud code. I've used this to handle reconnecting of players who had some network issues/crashing. So far I've found nothing similar in gamelift. Is there a way to get an event out to lambda or SNS every time a game session closes (for any reason, ended, crashed, terminated, all need to be caught)?

Thank you!

已提问 2 年前757 查看次数
6 回答
0
已接受的回答

Hi @REDACTEDUSER

Sorry for the late reply. GameLift logs process abnormal termination in fleet events (accessible via DescribeFleetEvents, e.g. SERVER_PROCESS_CRASHED, see [doc](https://docs.aws.amazon.com/id_id/cli/latest/reference/gamelift/describe-fleet-******

So, you can poll DescribeFleetEvent to see whether game session has crashed. Hopefully this suffices your use case in the short term. We currently do not offer fleet events in SNS, but this has been requested in the past and is being tracked in our backlog.

#14510

已回答 2 年前
0

When calling InitSDK in your server, it takes in a parameter of type ProcessParameters, which takes in a handler function called onProcessTerminate that I believe fits your needs in this situation. For more info, check https://docs.aws.amazon.com/gamelift/latest/developerguide/integration-server-sdk-cpp-ref-datatypes.html#integration-server-sdk-cpp-ref-dataypes-process

已回答 2 年前
0

Thank you for your answer, but it doesn't fit my need. In case of process crashing, it cannot catch it. The gamelift service itself knows when a game is terminated, because it can gather logs, and upload them on s3, I believe, so I was wondering if there is an event there I could catch.

已回答 2 年前
0

Would also like to know if there's an event similar to the FlexMatch or placement events that can trigger when a game session is terminated. Currently we're invoking a lambda on termination from the game script, but crashes are indeed a problem. We're currently tracking our player's status (playing/idle), and if a player is attempting an API call (for example, start matchmaking) when they're already in playing state, we're polling gamelift via describe player session to see if it shows as terminated and if it is, then we're assuming that the gamescript has crashed

已回答 2 年前
0

Thanks for the reply!

Using the other API polling calls is discouraged, is that similar for this one? Is there a limit on the frequency of calling DescribeFleetEvent?

@REDACTEDUSER

process.on('uncaughtException', function(error) { InvokeSessionCompletionListenerLambda(); });

process.on('unhandledRejection', function(reason, p){ InvokeSessionCompletionListenerLambda(); });

已回答 2 年前
0

Using the other API polling calls is discouraged, is that similar for this one?

That would be the case if there is a better alternative using push. Also, different from DescribeMatchmaking, DescribeGameSessionPlacement or DescribeGameSession, (which are the 3 APIs that customers incorrectly poll the most) which are not scalable to poll because you'd hit a bottleneck beyond a certain point as your game grows. However, since there is only limited number of fleet regardless of how large your game is, polling DescribeFleetEvent is reasonably scalable.

已回答 2 年前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则