- 新しい順
- 投票が多い順
- コメントが多い順
Hey Terrek7,
Please take a look at the GameLift developer's guide: https://aws.amazon.com/blogs/gametech/a-guide-to-amazon-gamelift-game-servers/, which has the answers that you need with reference architectures in sections:
- "Standalone Game Session Servers with a Serverless Backend": Flexmatch SNS topic triggers a lambda to store tickets into dynamodb, and separate client calls to fetch ticket status would poll this table for ticket status updates.
- "Standalone Game Session Servers with WebSockets-based Backend": Flexmatch SNS topic triggers a lambda to call game clients directly via ApiGateway Websocket
Thanks JamesM_Aws! Actual I could not find your 2 mentioned points in your link (not even in the ebook). But nonetheless, that helped me already a lot!
But just one additional question regarding SNS: I created a SNS topic with a lambda target and logged the events in lambda. And when 2 players were requesting for matchmaking, I got actual "3" message of type "MatchmakingSucceeded" for the same match (same matchId). Is this on purpose? I mean one would be enough, and since I have to pay for each lambda-call this is a bit annoying.
Hmm, that's strange, is it consistently reproducible? If so, could you PM me more information (e.g. region, account id, matchmaking configuration name, timestamp, match id, ticket ids, etc.) for us to investigate?
Alternatively, FlexMatch also emit messages to CloudWatch Event, perhaps try setting up a lambda to listen to CW events to see if the issue persists? If so, please let us know.
Another approach is to put SQS in between your SNS and Lambda (i.e. SNS -> SQS -> Lambda), the benefits are:
- You are able to batch process multiple records with a single lambda execution (https://docs.aws.amazon.com/lambda/latest/dg/with-sqs.html#events-sqs-eventsource), you could potentially do some deduping there.
- You are able to reprocess failed records (however, game sessions are short-lived so this feature may not be that useful)
Hey JammesM_Aws,
thanks again and thanks for your offer to help!
Actual the same happened also with a CloudWatch Event, 3 instead of 1 message. But I could figure out to resolve the problem. I had an error in my lambda function, which caused it to run ~3000ms. It seems when there is no return to the sns/event within a second, then it will trigger again a lambda function. So as soon as the lambda problem was solved and it was running <1000ms, the problem was gone.
Then I came to see that I can not filter the messages of SNS coming from GameLift, because there were no "MessageAttributes" on it. The whole MatchmakingMessage was put stringified in "message". And as I understood, you can only filter for "MessageAttributes".
But at least CloudWatch Event had the option to filter for the messages I needed (MatchmakingSucceeded, MatchmakingTimedOut, MatchmakingFailed), so I used this instead (higher latency of ~500ms, instead of ~30ms with sns, but it's still fine)
So everything is working now, thanks again for the help!
Terrek 7
Glad you fixed the issue! I have submitted a feature request to add MessageAttributes to Flexmatch/GameSessionQueue SNS messages.
For other folks in the future, please +1 on this if you also want this feature, so you could help us prioritize, thanks!
GLIFT-14918