question

Ryan Belgrave avatar image
Ryan Belgrave asked

Call HTTP URL when match is found

I've been trying to figure out how to get a notification on when a match is found. The game I am working on is 100% serverless using GCP functions and it has no persistent server that is running.

According to the docs, the only way to natively get a notification of a match being found through the SDK is to open a websocket. Obviously with a serverless architecture I can't have a websocket open for any meaningful amount of time. So I'm trying to look for alternatives:

Data Webhooks:

I see under Analyze -> Data there is a webhooks tab which said "send filtered lists of events to an external web service". This seems to be a good solution as I can give headers for authentication. However there doesn't seem to be a match found event that I can select. Also from reading the docs I can't figure out when "whenever a new event is emitted" means. Are events emitted exactly or fairly close to when they actually happen, or can there be a noticable delay between when the event actually happened and it being emitted?

Playstream (Automation?) Rules w/Cloud Script HTTP Trigger

I can create a rule for match_found event type and have it call a Cloud Script with HTTP Trigger. I eventually found the docs for what a model for that event may look like to the HTTP URL, but I can't find what the overall payload looks like. Also there doesn't seem to be any way to do authentication headers with a Cloud Script HTTP Trigger. The docs also make it seem like HTTP Triggers can only call Azure functions, if so, how does that authentication actually work?

Has anyone done this before? Is there better documentation I should be looking at? Or is all this just not possible.

CloudScriptwebhooksPlayStream
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
Gosen Gao avatar image
Gosen Gao answered

There is matchmaking_match_found - PlayFab | Microsoft Learn event which you can use it to trigger the Rule to send requests with Cloud Functions. I not familiar with “GCP functions”, but you can try to use it with Cloud Functions. For payload, you can create a test Azure Function by following PlayFab CloudScript using Azure Functions Quickstart Guide - PlayFab | Microsoft Learn and PlayFab CloudScript using Azure Functions Context Models - PlayFab | Microsoft Learn to know it. If the “authentication” you mention means security mechanism, you can refer to Authorization level & Function access keys. BTW, we’d recommend using Queue trigger with Azure Function for your scenario.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.