Sign In Register

How can we help you today?

Start a new topic
Answered

Something unclear about Requests and Resonses

 Dear support, dear community,


I am just creating a sandbox fantasygame in Unreal 4 using GameSparks as a backend. In my game the player should have the opportunity to create multiple characters. I created a custom event to invoke or rather request a list of character-data according from the nosql database. I already figured, that you can use the GSLogEventRequest to invoke the event on the server.

My question is:

How do you configure the response and also the sending of the response? Is there any code that I can use in Cloud Code? Does somebody have an example on how to setup a response for a custom event? Or at least an explanation? :-).



Best wishes

Nicolas


Best Answer

Hi Nicolas,


Responses in Cloud Code are set by configuring scriptData or scriptErrors.


Using Spark.setScriptData(key, value) in Cloud code is generally how you control the response being issued to the client based off of the inputs that have been received through Spark.getData.


You can also set errors via Spark.setScriptError.


This applies for all requests and responses on the platform. When you set data in the Cloud Code for a request, you can retrieve this set data in the response for that request, so no data is lost.


Hope this helps! Let me know if you'd like more details.


-Pádraig

1 Comment

Answer

Hi Nicolas,


Responses in Cloud Code are set by configuring scriptData or scriptErrors.


Using Spark.setScriptData(key, value) in Cloud code is generally how you control the response being issued to the client based off of the inputs that have been received through Spark.getData.


You can also set errors via Spark.setScriptError.


This applies for all requests and responses on the platform. When you set data in the Cloud Code for a request, you can retrieve this set data in the response for that request, so no data is lost.


Hope this helps! Let me know if you'd like more details.


-Pádraig

Login to post a comment