question

Jota Serna (GameHouse) avatar image
Jota Serna (GameHouse) asked

Sending Telemetry events from Server

Hi everyone!

Hope you're all well & safe!

I have some questions about how to send (non-Playstream) Telemetry events from server, both from Cloudscript and from the C# SDK in a server environment. In particular:

  1. Cloudscript: I haven't found a way to send telemetry events from Cloudscript, but I have the feeling that this is somehow related to the Entities API. I would really appreciate if you could shed some wisdom on this.
  2. C# SDK in a server environment: I understand that the correct way to do this would be to use method PlayFabEventsAPI.WriteTelemetryEventsAsync passing a valid entity token through the request context. I understand that, from a client perspective, a client login is sufficient to use this method. Please, correct me if I'm wrong.

Thank you very much for your time & help!

Cheers!

apissdksCloudScriptentities
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

·
Seth Du avatar image
Seth Du answered
  • Cloud Script is able to call WriteTelemetryEvents, simply via:
var result = entity.WriteTelemetryEvents(request);
  • The execution of Cloud Script will generate an Event, which already can include necessary logs(you defined in codes). In the normal circumstances, we won’t suggest writing Telemetry Events in Cloud Script, because there are specified limits on Cloud Script usage, which may not suit the common usage scenario of Telemetry Events. Meanwhile, it will be fine to use an external server (your C# scenario) for this purpose.
  • In terms of C# implementation, please understand that WriteTelemetryEvents API requires the same entity key as the API caller. For example, if you are calling this API in a client, the Entity key must be set as the same key as the logged in player. However, since you are implementing this on an external server, it will be more convenient to call it with a title-level token. The common method is store the secret key in the server side (PlayFabApiSettings) and call GetEntityToken API to retrieve the title-level entity token and store it in PlayFabAuthenticationContext.
1 comment
10 |1200

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

Jota Serna (GameHouse) avatar image Jota Serna (GameHouse) commented ·

Understood. Very useful information. Thank you.

0 Likes 0 ·

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.