Skip to content

FlexMatch: how to receive the SNS topic messages in client app?

0

Hi

I'm following this roadmap: https://docs.aws.amazon.com/gameliftservers/latest/flexmatchguide/match-tasks.html

I've reached point: "Set up notifications (optional). Since matchmaking requests are asynchronous, you need a way to track the status of requests. Notifications is the preferred option. See this topic: Set up FlexMatch event notifications"

The SNS topic has been created and attached to a matchmaking configuration SNS topic field. However I don't understand from the tutorials how to receive the event in my client app, which is a Unity app.

I read this: https://docs.aws.amazon.com/gameliftservers/latest/flexmatchguide/match-notification-lambda.html What should the FlexMatchEventHandlerLambdaFunction do when it's called?

Thanks!

1 Answer
1
Accepted Answer

To receive FlexMatch event notifications in your Unity client app, you'll need to implement a solution that bridges the gap between AWS SNS and your client application. The SNS topic itself doesn't directly push notifications to your game clients.

Here's how you can approach this:

  1. Lambda Function Implementation: The FlexMatchEventHandlerLambdaFunction mentioned in the documentation should process the matchmaking events from SNS and relay them to your clients. This Lambda function could:
  • Store event data in a database like DynamoDB
  • Send updates to your clients via WebSockets
  • Trigger other services that can communicate with your clients
  1. Client Communication Options:
  • WebSockets: Set up an AWS API Gateway with WebSocket support, where your Lambda pushes messages that clients can subscribe to
  • Client Polling: Have your Unity app periodically check a database or API endpoint that's updated by the Lambda
  • Push Notifications: For mobile games, you could use mobile push notification services
  1. Unity Implementation: In your Unity client, you'll need to:
  • Implement WebSocket connections if using that approach
  • Or create polling mechanisms to check for updates
  • Handle and process the matchmaking events when received

As a backup strategy, you should also implement periodic polling for status updates if a significant period passes without notifications. Wait at least 30 seconds after ticket submission or the last notification before polling, and poll no more than once every 10 seconds to minimize impact on matchmaking performance.

This approach is highly scalable compared to having clients directly call the Describe APIs repeatedly. For high-volume matchmaking, event-based architectures are strongly recommended over continuous polling.
Sources
Configure a topic subscription to invoke a Lambda function - Amazon GameLift Servers
Set up FlexMatch event notifications - Amazon GameLift Servers
Track matchmaking events - Amazon GameLift Servers
Development phase steps for successful launches on Amazon GameLift Servers | AWS for Games Blog

answered a month ago
AWS
EXPERT
reviewed a month ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.