Trouble with FlexMatch event flow

Hi, I’m attempting to get FlexMatch matchmaking working but am confused on how to ultimately notify the client device that the match has been fulfilled (and also what GameLift server url/port should be called). The flow so far:

  1. Unity game client will call my API gateway endpoint backed by my MatchmakingLambda
  2. MatchmakingLambda will use the GameLift client from the SDK to call StartMatchmaking. Since the request is asynchronous, the lambda will return the ticket id to the game client before any match is made (so I presume no connection info is available).
  3. Unity game client is waiting for notification of successful or unsuccessful match, but how?

The docs are clear that polling the DescribeMatchmaking on the GameLift client shouldn’t be done in production and suggest an SNS topic that triggers a lambda but I’m not sure how this completes the circle back to the game client.

Thanks in advance!

There are many ways to circle it back to the game client but a common one is that the Lambda function subscribed to the SNS topic will write information to a DynamoDB table that either the client can poll on or subscribe to a WebSocket API that gets real-time updates about the DynamoDB table via DynamoDB streams.

@chrisgong Thanks for the reply! Much appreciated. Using an SNS topic to write the information to DynamoDB and then polling from the client sounds like the most convenient but would you say that this is not best practice? The reason I ask is that–per the GameLift docs–polling the DescribeMatchmaking function was discouraged. If I were to create an API Gateway endpoint that the client just polled to get the match status, wouldn’t I just be shifting the load from DescribeMatchmaking to elsewhere in AWS? Perhaps it is okay because the new endpoint is a more trivial one (ie. a fairly efficient select from the DynamoDB table)?

You are technically right that you’re just shifting the load but I guess querying a DynamoDb table is a little better than calling DescribeMatchmaking, might need an AWS Game tech staff member to give you a better explanation on that. However, that’s also why I recommend the DynamoDB streams + WebSocket API option since in this case, your client is just watching for updates to a DynamoDB table.

@chrisgong I will definitely look into the WebSocket+DynamoDB Streams approach but good to know of the other option if I can’t get things working with that. Thanks again for your help!